Giter Club home page Giter Club logo

huawei-garbage's Introduction

华为云垃圾分类挑战杯亚军方案分享

1.代码结构

 {repo_root}
  ├── models	//模型文件夹
  ├── utils		//一些函数包
  |   ├── eval.py		// 求精度
  │   ├── misc.py		// 模型保存,参数初始化,优化函数选择
  │   ├── radam.py
  │   └── ...
  ├── args.py		//参数配置文件
  ├── build_net.py		//搭建模型
  ├── dataset.py		//数据批量加载文件
  ├── preprocess.py		//数据预处理文件,生成坐标标签
  ├── train.py		//训练运行文件
  ├── transform.py		//数据增强文件

2. 环境设置

可以直接通过pip install -r requirements.txt安装指定的函数包,python版本为3.6,具体的函数包如下:

  • pytorch>=1.0.1
  • torchvision==0.2.2
  • matplotlib>=3.1.0
  • numpy>=1.16.4
  • scikit-image
  • pandas
  • sklearn

注:py3.7训练的话,要修改下面的代码 if use_cuda: inputs, targets = inputs.cuda(), targets.cuda(async=True) inputs, targets = torch.autograd.Variable(inputs), torch.autograd.Variable(targets) #python3.7已经移除了async关键字,而用non_blocking代替。(导致apache-airflow也出了问题) #cuda() 本身也没有async.

就是把 async=True去掉

if use_cuda: inputs, targets = inputs.cuda(), targets.cuda() inputs, targets = torch.autograd.Variable(inputs), torch.autograd.Variable(targets)`

3.运行步骤

  1. 建立文件夹data,把garbage_classify全部解压缩到data下
  2. 运行preprocess.py,生成训练集和测试集运行文
  3. 单张显卡的话,修改arg.py 85行 parser.add_argument('--gpu-id', default='0, 1, 2, 3' 为'--gpu-id', default='0',同时修改 '--train-batch','--test-batch'为适当的数字
  4. 运行train.py

4.方案思路

方案讲解

知乎专栏:ML与DL成长之路

如果复现过程中有bug,麻烦反馈一下,会优化更新。如果对您有帮助记得给个star


小尾巴

QQ群:AI成长社①:545702197

微信群:添加微信号:Derek_wen8,备注:加群

huawei-garbage's People

Contributors

qlmx avatar litou-lyh avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.