GithubHelp home page GithubHelp logo

pytorch_multi_task_classifier's Introduction

Image multi-task classfication

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

图片名称 图片名称

*** example
models (...等) 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

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_multi_task.py --data_dir "./data/data.csv" --n_splits 3 --output_dir "./data/train.csv" --random_state 2020

resnet18

1、Modify configuration file

cp conf/resnet18.yaml conf/resnet18.yaml
vim conf/resnet18.yaml

2、Train:

python train_multi_task.py --config_path conf/resnet18.yaml

3、Infer

    python infer_multi_task.py --config_path "conf/resnet18.yaml" --img_path "./data/img/0male/1_2.jpg" --fold "0"
    pre>>>>> [0] [0.6254628] [2] [0.8546583]
    python infer_multi_task.py --config_path "conf/resnet18.yaml" --img_path "./data/img/1female/2_5.jpg" --fold "1"

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

    onnx:python tools/pytorch_to_onnx_multi_task.py --config_path "conf/resnet18.yaml" --img_path "./data/img/0male/1_2.jpg" --batch_size 4 --fold 0 --save_path "lp.onnx"

    tensorrt:python tools/onnx_to_tensorrt_multi_task.py --config_path "conf/resnet18.yaml" --img_path "./data/img/0male/1_2.jpg" --batch_size 4 --fold 0 --save_path "lp_pp.onnx" --trt_save_path "lp.trt"

5、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 

pytorch_multi_task_classifier's People

Contributors

machinelp avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  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.