• Stars
    star
    212
  • Rank 185,016 (Top 4 %)
  • Language
    Python
  • Created over 6 years ago
  • Updated about 1 year ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Image classification: efficientnet/resnest/seresnext/.....

Image classfication

Easy-to-use/Easy-to-deploy/Easy-to-develop

图片名称 图片名称

*** example
models (efficientnet/mobilenet/resnest/seresnext等) 1
metric (Swish/ArcMarginProduct_subcenter/ArcFaceLossAdaptiveMargin/...) 2
data aug (rotate/flip/...、mixup/cutmix) 3
loss (ce_loss/ce_smothing_loss/focal_loss/bce_loss/...) 4
deploy (flask/grpc/BentoML等) 5
onnx/trt () 6

models:

RESNEST_LIST = ['resnest50', 'resnest101', 'resnest200', 'resnest269']

SERESNEXT_LIST = ['seresnext101']

GEFFNET_LIST = ['GenEfficientNet', 'mnasnet_050', 'mnasnet_075', 'mnasnet_100', 'mnasnet_b1', 'mnasnet_140', 'semnasnet_050', 'semnasnet_075', 'semnasnet_100', 'mnasnet_a1', 'semnasnet_140', 'mnasnet_small','mobilenetv2_100', 'mobilenetv2_140', 'mobilenetv2_110d', 'mobilenetv2_120d', 'fbnetc_100', 'spnasnet_100', 'efficientnet_b0', 'efficientnet_b1', 'efficientnet_b2', 'efficientnet_b3', 'efficientnet_b4', 'efficientnet_b5', 'efficientnet_b6', 'efficientnet_b7', 'efficientnet_b8', 'efficientnet_l2', 'efficientnet_es', 'efficientnet_em', 'efficientnet_el', 'efficientnet_cc_b0_4e', 'efficientnet_cc_b0_8e', 'efficientnet_cc_b1_8e', 'efficientnet_lite0', 'efficientnet_lite1', 'efficientnet_lite2', 'efficientnet_lite3', 'efficientnet_lite4', 'tf_efficientnet_b0', 'tf_efficientnet_b1', 'tf_efficientnet_b2', 'tf_efficientnet_b3', 'tf_efficientnet_b4', 'tf_efficientnet_b5', 'tf_efficientnet_b6', 'tf_efficientnet_b7', 'tf_efficientnet_b8', 'tf_efficientnet_b0_ap', 'tf_efficientnet_b1_ap', 'tf_efficientnet_b2_ap', 'tf_efficientnet_b3_ap', 'tf_efficientnet_b4_ap', 'tf_efficientnet_b5_ap', 'tf_efficientnet_b6_ap', 'tf_efficientnet_b7_ap', 'tf_efficientnet_b8_ap', 'tf_efficientnet_b0_ns', 'tf_efficientnet_b1_ns', 'tf_efficientnet_b2_ns', 'tf_efficientnet_b3_ns', 'tf_efficientnet_b4_ns', 'tf_efficientnet_b5_ns', 'tf_efficientnet_b6_ns', 'tf_efficientnet_b7_ns', 'tf_efficientnet_l2_ns', 'tf_efficientnet_l2_ns_475', 'tf_efficientnet_es', 'tf_efficientnet_em', 'tf_efficientnet_el', 'tf_efficientnet_cc_b0_4e', 'tf_efficientnet_cc_b0_8e', 'tf_efficientnet_cc_b1_8e', 'tf_efficientnet_lite0', 'tf_efficientnet_lite1', 'tf_efficientnet_lite2', 'tf_efficientnet_lite3', 'tf_efficientnet_lite4', 'mixnet_s', 'mixnet_m', 'mixnet_l', 'mixnet_xl', 'tf_mixnet_s', 'tf_mixnet_m', 'tf_mixnet_l', 'mobilenetv3_rw', 'mobilenetv3_large_075', 'mobilenetv3_large_100', 'mobilenetv3_large_minimal_100','mobilenetv3_small_075', 'mobilenetv3_small_100', 'mobilenetv3_small_minimal_100','tf_mobilenetv3_large_075', 'tf_mobilenetv3_large_100', 'tf_mobilenetv3_large_minimal_100','tf_mobilenetv3_small_075', 'tf_mobilenetv3_small_100', 'tf_mobilenetv3_small_minimal_100']

train/test/deploy

0、Data format transform

git clone https://github.com/MachineLP/PyTorch_image_classifier
pip install -r requirements.txt
cd PyTorch_image_classifier
python tools/data_preprocess.py --data_dir "./data/data.csv" --n_splits 5 --output_dir "./data/train.csv" --random_state 2020

resnest101

1、Modify configuration file

cp conf/resnest101.yaml conf/resnest101.yaml
vim conf/resnest101.yaml

2、Train:

python train.py --config_path conf/resnest101.yaml

3、Test

python test.py --config_path "conf/resnest101.yaml" --n_splits 5

4、Infer

    python infer.py --config_path "conf/resnest101.yaml" --img_path "./data/img/0male/0(2).jpg" --fold "0"
    pre>>>>> [1]
    python infer.py --config_path "conf/resnest101.yaml" --img_path "./data/img/1female/1(5).jpg" --fold "1"
    pre>>>>> [0]

5、Models transform ( https://github.com/NVIDIA-AI-IOT/torch2trt )(Tensorrt installation guide on Ubuntu1804)

    onnx:python tools/pytorch_to_onnx.py --config_path "conf/resnest101.yaml" --img_path "./data/img/0male/0(2).jpg" --batch_size 4 --fold 0 --save_path "lp.onnx"
    '''
    load model ok.....
    >>>>> [[-0.15416172  0.36190417]]
    cost time: 0.050855159759521484
    ==> Exporting model to ONNX format at 'lp.onnx'
    >>>>> (1, 3, 512, 512)
    preds>>>>> [array([[-0.15416166,  0.36190417]], dtype=float32)]
    cost time: 3.649467706680298
    error_distance: 2.9802322e-08
    '''

    tensorrt:python tools/onnx_to_tensorrt.py --config_path "conf/resnest101.yaml" --img_path "./data/img/0male/0(2).jpg" --batch_size 4 --fold 0 --save_path "lp_pp.onnx" --trt_save_path "lp.trt"
    '''
    outputs: tensor([[-0.1543,  0.3619]])
    tensor([0.6263]) tensor([1])
    '''

6、Deploying models serving

effb3_ns

1、Modify configuration file

cp conf/test.yaml conf/effb3_ns.yaml
vim conf/effb3_ns.yaml

2、Train:

python train.py --config_path "conf/effb3_ns.yaml"

3、Test

python test.py --config_path "conf/effb3_ns.yaml" --n_splits 5

4、Infer

    python infer.py --config_path "conf/effb3_ns.yaml" --img_path "./data/img/0male/0(2).jpg" --fold "0"
    pre>>>>> [1]
    python infer.py --config_path "conf/effb3_ns.yaml" --img_path "./data/img/1female/1(5).jpg" --fold "1"
    pre>>>>> [0]

5、Models transform ( https://github.com/NVIDIA-AI-IOT/torch2trt )(Tensorrt installation guide on Ubuntu1804)

    onnx:python tools/pytorch_to_onnx.py --config_path "conf/effb3_ns.yaml" --img_path "./data/img/0male/0(2).jpg" --batch_size 4 --fold 0 --save_path "lp.onnx"
    tensorrt:python tools/onnx_to_tensorrt.py

6、Deploying models serving

ref

(1)https://github.com/haqishen/SIIM-ISIC-Melanoma-Classification-1st-Place-Solution
(2)https://github.com/BADBADBADBOY/pytorchOCR
(3)https://github.com/MachineLP/QDServing
(4)https://github.com/bentoml/BentoML
(5)mixup-cutmix:https://blog.csdn.net/u014365862/article/details/104216086
(7)focalloss:https://blog.csdn.net/u014365862/article/details/104216192
(8)https://blog.csdn.net/u014365862/article/details/106728375 / https://blog.csdn.net/u014365862/article/details/106728402 

More Repositories

1

Tensorflow-

Tensorflow实战学习笔记、代码、机器学习进阶系列
Jupyter Notebook
1,129
star
2

TextMatch

QAmatch(qa_match)/文本匹配/文本分类/文本embedding/文本聚类/文本检索(bow/ifidf/ngramtf-df/bert/albert/bm25/…/nn/gbdt/xgb/kmeans/dscan/faiss/….)
Python
839
star
3

CodeFun

DataStructure(SwordOffer、LeetCode)、Deep Learning(Tensorflow、Keras、Pytorch)、Machine Learning(sklearn、spark)、AutoML、AutoDL、ModelDeploying、SQL
Jupyter Notebook
344
star
4

OCR_Keras

OCR;文本检测、文本识别(cnn+ctc、crnn+ctc)。
Python
208
star
5

train_arch

cnn+rnn+attention: vgg(vgg16,vgg19)+rnn(LSTM, GRU)+attention, resnet(resnet_v2_50,resnet_v2_101,resnet_v2_152)+rnnrnn(LSTM, GRU)+attention, inception_v4+rnn(LSTM, GRU)+attention, inception_resnet_v2+rnn(LSTM, GRU)+attention,..... vgg(vgg16,vgg19), resnet(resnet_v2_50,resnet_v2_101,resnet_v2_152), inception_v4, inception_resnet_v2,.....
Python
189
star
6

OpenCV-

OpenCV学习笔记
C++
95
star
7

TensorFlowTTS_chinese

chinese tts
Jupyter Notebook
76
star
8

train_cnn-rnn

cnn+rnn: vgg(vgg16,vgg19)+rnn(LSTM, GRU), resnet(resnet_v2_50,resnet_v2_101,resnet_v2_152)+rnnrnn(LSTM, GRU), inception_v4+rnn(LSTM, GRU), inception_resnet_v2+rnn(LSTM, GRU),.....
Python
63
star
9

QDServing

ml模型分布式服务部署:grpc,flask;docker
Python
62
star
10

Spark-

Spark学习笔记
Jupyter Notebook
42
star
11

face_stickers

人脸贴纸
Python
32
star
12

train_cnn_GANs

GANs:DCGAN
Python
21
star
13

Pytorch_multi_task_classifier

multi-task classifier
Python
21
star
14

py_workSpace

MachineLP的工具包
Python
18
star
15

conditional-similarity-networks-Tensorflow

Conditional Similarity Networks (CSNs-Tensorflow)
Python
11
star
16

cnn_faceDetection

cpp code: using cnn for face detection
C++
7
star
17

LaneDetection

lane Detection
C++
5
star
18

qa-corpus-zh

问答语料库整理
5
star
19

FashionAI_KeyPoints_Detection

This my project of Fashion AI Key points detection contest.
Python
5
star
20

PyTorch_video_classifier

video recognition
Python
3
star
21

MachineLP

2
star
22

vehicleDetection

C++
2
star
23

Inception_v4_slim

【Ubuntu】slim框架下的inception_v4模型的运行、可视化、导出和使用
Python
1
star