{"id":13738223,"url":"https://github.com/MachineLP/PyTorch_image_classifier","last_synced_at":"2025-05-08T16:32:55.990Z","repository":{"id":37623174,"uuid":"129069929","full_name":"MachineLP/PyTorch_image_classifier","owner":"MachineLP","description":"Image classification: efficientnet/resnest/seresnext/.....","archived":false,"fork":false,"pushed_at":"2024-01-29T12:12:52.000Z","size":3272,"stargazers_count":250,"open_issues_count":10,"forks_count":74,"subscribers_count":14,"default_branch":"master","last_synced_at":"2024-11-15T07:33:59.234Z","etag":null,"topics":["efficientnet","image-classification","resnest","seresnext"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/MachineLP.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null}},"created_at":"2018-04-11T09:35:10.000Z","updated_at":"2024-10-11T14:18:43.000Z","dependencies_parsed_at":"2024-04-20T17:04:15.853Z","dependency_job_id":null,"html_url":"https://github.com/MachineLP/PyTorch_image_classifier","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MachineLP%2FPyTorch_image_classifier","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MachineLP%2FPyTorch_image_classifier/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MachineLP%2FPyTorch_image_classifier/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MachineLP%2FPyTorch_image_classifier/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/MachineLP","download_url":"https://codeload.github.com/MachineLP/PyTorch_image_classifier/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":253105397,"owners_count":21855019,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["efficientnet","image-classification","resnest","seresnext"],"created_at":"2024-08-03T03:02:14.960Z","updated_at":"2025-05-08T16:32:55.546Z","avatar_url":"https://github.com/MachineLP.png","language":"Python","funding_links":[],"categories":["Python"],"sub_categories":[],"readme":"\n\n# Image classfication\n\nEasy-to-use/Easy-to-deploy/Easy-to-develop\n\n\u003cimg src=\"https://user-images.githubusercontent.com/9102141/87268895-3e0d0780-c4fe-11ea-849e-6140b7e0d4de.gif\" width = \"300\" height = \"200\" alt=\"图片名称\" align=center\u003e \u003cimg src=\"https://user-images.githubusercontent.com/9102141/87268895-3e0d0780-c4fe-11ea-849e-6140b7e0d4de.gif\" width = \"300\" height = \"200\" alt=\"图片名称\" align=center\u003e\n\n\n|      ***       |        |    example   |  \n| :-----------------: | :---------:| :---------:|\n|  models  |   (efficientnet/mobilenet/resnest/seresnext等)       |  [1](./qdnet/conf/constant.py)  |\n|  metric  |   (Swish/ArcMarginProduct_subcenter/ArcFaceLossAdaptiveMargin/...)       |  [2](./qdnet/models/metric_strategy.py)  |\n|  data aug  |   (rotate/flip/...、mixup/cutmix)         |  [3](./qdnet/dataaug/) | \n|  loss  |   (ce_loss/ce_smothing_loss/focal_loss/bce_loss/...)                     |  [4](./qdnet/loss/)    | \n|  deploy  |   (flask/grpc/BentoML等)                   |  [5](./serving/)       | \n|  onnx/trt |   ()                                      |  [6](./tools/)         | \n\n\n## models：\n\n\u003e RESNEST_LIST = ['resnest50', 'resnest101', 'resnest200', 'resnest269']\n\n\u003e SERESNEXT_LIST = ['seresnext101']\n\n\u003e 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']\n\n#\n\n## train/test/deploy\n0、Data format transform \n```\ngit clone https://github.com/MachineLP/PyTorch_image_classifier\npip install -r requirements.txt\ncd PyTorch_image_classifier\npython tools/data_preprocess.py --data_dir \"./data/data.csv\" --n_splits 5 --output_dir \"./data/train.csv\" --random_state 2020\n```\n\n## resnest101\n1、Modify configuration file\n\n```\ncp conf/resnest101.yaml conf/resnest101.yaml\nvim conf/resnest101.yaml\n```\n\n2、Train: \n\n```\npython train.py --config_path conf/resnest101.yaml\n```\n\n3、Test\n\n```\npython test.py --config_path \"conf/resnest101.yaml\" --n_splits 5\n```\n\n4、Infer\n```\n    python infer.py --config_path \"conf/resnest101.yaml\" --img_path \"./data/img/0male/0(2).jpg\" --fold \"0\"\n    pre\u003e\u003e\u003e\u003e\u003e [1]\n    python infer.py --config_path \"conf/resnest101.yaml\" --img_path \"./data/img/1female/1(5).jpg\" --fold \"1\"\n    pre\u003e\u003e\u003e\u003e\u003e [0]\n```\n\n\n5、Models transform ( https://github.com/NVIDIA-AI-IOT/torch2trt )([Tensorrt installation guide on Ubuntu1804](./docs/Tensorrt_installation_guide_on_Ubuntu1804.md))\n\n```\n    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\"\n    '''\n    load model ok.....\n    \u003e\u003e\u003e\u003e\u003e [[-0.15416172  0.36190417]]\n    cost time: 0.050855159759521484\n    ==\u003e Exporting model to ONNX format at 'lp.onnx'\n    \u003e\u003e\u003e\u003e\u003e (1, 3, 512, 512)\n    preds\u003e\u003e\u003e\u003e\u003e [array([[-0.15416166,  0.36190417]], dtype=float32)]\n    cost time: 3.649467706680298\n    error_distance: 2.9802322e-08\n    '''\n\n    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\"\n    '''\n    outputs: tensor([[-0.1543,  0.3619]])\n    tensor([0.6263]) tensor([1])\n    '''\n```\n\n6、Deploying models\n[serving](./serving/) \n\n\n#\n\n## effb3_ns\n1、Modify configuration file\n\n```\ncp conf/test.yaml conf/effb3_ns.yaml\nvim conf/effb3_ns.yaml\n```\n\n2、Train: \n\n```\npython train.py --config_path \"conf/effb3_ns.yaml\"\n```\n\n3、Test\n\n\n```\npython test.py --config_path \"conf/effb3_ns.yaml\" --n_splits 5\n```\n\n4、Infer\n\n```\n    python infer.py --config_path \"conf/effb3_ns.yaml\" --img_path \"./data/img/0male/0(2).jpg\" --fold \"0\"\n    pre\u003e\u003e\u003e\u003e\u003e [1]\n    python infer.py --config_path \"conf/effb3_ns.yaml\" --img_path \"./data/img/1female/1(5).jpg\" --fold \"1\"\n    pre\u003e\u003e\u003e\u003e\u003e [0]\n```\n\n\n5、Models transform ( https://github.com/NVIDIA-AI-IOT/torch2trt )([Tensorrt installation guide on Ubuntu1804](./docs/Tensorrt_installation_guide_on_Ubuntu1804.md))\n\n```\n    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\"\n    tensorrt：python tools/onnx_to_tensorrt.py\n```\n\n6、Deploying models\n[serving](./serving/) \n\n\n\n\n#\n\n#\n\n#\n\n#\n\n#\n\n#\n\n#\n\n#### ref\n```\n（1）https://github.com/haqishen/SIIM-ISIC-Melanoma-Classification-1st-Place-Solution\n（2）https://github.com/BADBADBADBOY/pytorchOCR\n（3）https://github.com/MachineLP/QDServing\n（4）https://github.com/bentoml/BentoML\n（5）mixup-cutmix:https://blog.csdn.net/u014365862/article/details/104216086\n（7）focalloss:https://blog.csdn.net/u014365862/article/details/104216192\n（8）https://blog.csdn.net/u014365862/article/details/106728375 / https://blog.csdn.net/u014365862/article/details/106728402 \n```\n\n\n\n\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FMachineLP%2FPyTorch_image_classifier","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FMachineLP%2FPyTorch_image_classifier","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FMachineLP%2FPyTorch_image_classifier/lists"}