Image Processing (3): image classification (garbage case) depth learning

AI garbage

product description

How to carry out waste has become a tortured soul living, but AI application in the garbage can right-hand man of residents.
For the current business needs, we design a APP, to support our business needs, mainly to provide text, voice, picture classification functions. AI intelligent garbage mainly by building image classification model based on the depth of learning technology to achieve precise focus on identifying spam with pictures categories pictures classification.
Shenzhen using garbage classification, the export of which belong to recyclable materials, kitchen waste, hazardous waste and other garbage.

Garbage - Data analysis and preprocessing

  • Overall data acquisition
  • Analysis of the distribution of different types of data
  • Picture aspect ratio distribution analysis
  • Segmentation data and validation sets
  • Data visualization display (visualization tools pyecharts, seaborn, matplotlib)

Code structure

├── data
│   ├── garbage-classify-for-pytorch
│   │   ├── train
│   │   ├── train.txt
│   │   ├── val
│   │   └── val.txt
│   └── garbage_label.txt
├── analyzer
│   ├── 01 垃圾分类_一级分类 数据分布.ipynb
│   ├── 02 垃圾分类_二级分类 数据分析.ipynb
│   ├── 03 数据加载以及可视化.ipynb
│   ├── 03 数据预处理-缩放&裁剪&标准化.ipynb
│   ├── garbage_label_40 标签生成.ipynb
├── models
│   ├── alexnet.py
│   ├── densenet.py
│   ├── inception.py
│   ├── resnet.py
│   ├── squeezenet.py
│   └── vgg.py
├── facebook
│   ├── app_resnext101_WSL.py
│   ├── facebookresearch_WSL-Images_resnext.ipynb
│   ├── ResNeXt101_pre_trained_model.ipynb
├── checkpoint
│   ├── checkpoint.pth.tar
│   ├── garbage_resnext101_model_9_9547_9588.pth
├── utils
│   ├── eval.py
│   ├── json_utils.py
│   ├── logger.py
│   ├── misc.py
│   └── utils.py
├── args.py
├── model.py
├── transform.py
├── garbage-classification-using-pytorch.py
├── app_garbage.py
  • data: training data and verification data, tag data
  • checkpoint: log data, the model file, the training process checkpoint intermediate data
  • app_garbage.py: Online prediction service
  • garbage-classification-using-pytorch.py: Trainer
  • models: providing various pre_trained_model, for example: alexlet, densenet, resnet, resnext etc.
  • utils: provide a variety of tools, for example; re flask json format, logging tools, impact assessment
  • facebook: providing facebook magic classifier and classification predicted data preprocessing
  • analyzer: data analysis and data preprocessing module
  • transform.py: data preprocessing by pytorch
  • model.py: resnext101 model integration and adjustment, packaging model training and validation function

resnext101 network architecture

  • pre_trained_model resnext101 network architecture principles
  • pytorch data processing, resnext101 prediction model based on classification
  • Online Services API interface

Garbage - training

python garbage-classification-using-pytorch.py \
        --model_name resnext101_32x16d \
        --lr 0.001 \
        --optimizer  adam \
        --start_epoch 1 \
        --epochs 10 \
        --num_classes 40
  • model_name model name
  • lr learning rate
  • optimizer optimizer
  • start_epoch training process breakpoint retraining
  • num_classes number of classification

Garbage - Evaluation

python garbage-classification-using-pytorch.py \
    --model_name resnext101_32x16d \
    --evaluate  \
    --resume checkpoint/checkpoint.pth.tar \
    --num_classes 40 
  • model_name model name
  • evaluate model assessment
  • resume designated checkpoint file path, save the model parameters and the training process

Garbage - Online prediction

python app_garbage.py \
    --model_name resnext101_32x16d \
    --resume checkpoint/garbage_resnext101_model_2_1111_4211.pth
  • model_name model name
  • resume training model file path
  • Model prediction
    command line verification and validation postman embodiment
    illustrated: the command line mode prediction
    curl -X POST -F [email protected] http: // ip: port / predict

Finally, we teach you how to master the garbage from 0-1. Through this study, allow you to completely master the application of AI image classification techniques in our practical work.

More exciting content, https://github.com/shenfuli/ai

Specific video explaining Please pay attention:

PyTorch real - depth study of image classification (garbage case)

https://edu.csdn.net/course/detail/26983

1. What is your trash?

Here Insert Picture Description

2. tell you what you are rubbish

Here Insert Picture Description

3. It tells you that you are what rubbishHere Insert Picture Description

4. garbage into the world, to master the waste disposal

Here Insert Picture Description

Published 267 original articles · won praise 66 · views 430 000 +

Guess you like

Origin blog.csdn.net/shenfuli/article/details/103008003
Recommended