{"id":19176542,"url":"https://github.com/deeplite/neutrino-examples","last_synced_at":"2025-05-07T19:23:56.920Z","repository":{"id":37870224,"uuid":"354958286","full_name":"Deeplite/neutrino-examples","owner":"Deeplite","description":"Public examples to use Deeplite Neutrino™ engine for model architecture optimization.","archived":false,"fork":false,"pushed_at":"2023-04-25T17:58:14.000Z","size":147,"stargazers_count":8,"open_issues_count":0,"forks_count":1,"subscribers_count":4,"default_branch":"master","last_synced_at":"2023-04-25T18:44:30.663Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Deeplite.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2021-04-05T20:05:32.000Z","updated_at":"2023-04-25T18:44:30.663Z","dependencies_parsed_at":"2023-01-20T23:16:59.504Z","dependency_job_id":null,"html_url":"https://github.com/Deeplite/neutrino-examples","commit_stats":null,"previous_names":[],"tags_count":null,"template":null,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Deeplite%2Fneutrino-examples","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Deeplite%2Fneutrino-examples/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Deeplite%2Fneutrino-examples/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Deeplite%2Fneutrino-examples/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Deeplite","download_url":"https://codeload.github.com/Deeplite/neutrino-examples/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":223815777,"owners_count":17207736,"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":[],"created_at":"2024-11-09T10:28:59.672Z","updated_at":"2024-11-09T10:29:00.340Z","avatar_url":"https://github.com/Deeplite.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"\n\u003cp align=\"center\"\u003e\n  \u003cimg src=\"https://github.com/Deeplite/neutrino-examples/raw/master/deeplite-logo-color.png\" /\u003e\n\u003c/p\u003e\n\n# Deeplite Neutrino Examples\n\nPublic examples to use [Deeplite Neutrino™](https://docs.deeplite.ai/neutrino/index.html) engine for model architecture optimization.\n\n\u003e **_NOTE:_**  Make sure you have obtained either a free community license or a commercial support license, [from here](https://docs.deeplite.ai/neutrino/license.html)\n\n## Classification Models\n\n```{.python}\n    python src/hello_neutrino_classifier.py --arch resnet18 --dataset cifar100 --delta 1\n```\n\nThe pretrained architecture `models` and the `datasets` are loaded from the [Deeplite Torch Zoo](https://github.com/Deeplite/deeplite-torch-zoo). The `delta` of 1% denotes the maximum affordable reduction in the accuracy of the model during optimization. Feel free to play around with different classification models and datasets, along with different `delta` values to get different optimized results. The `arch` and the `datasets` can be customized with any native PyTorch pretrained model.\n\n## Object Detection Models\n\nDifferent object detection use-cases and examples are provided to play around with.\n\nTo optimize a `SSD-300` model on [`VOC 2007 dataset`](http://host.robots.ox.ac.uk/pascal/VOC/), run the following,\n\n```{.python}\n    python src/hello_neutrino_ssd.py --arch resnet18_ssd --delta 0.05 --dataset voc -r  ~/PATH/TO/VOCdevkit\n```\n\nTo optimize a `SSD-300` model with `Mobilenet_v2` backend on [`COCO dataset`](https://cocodataset.org/#home), run the following,\n\n```{.python}\n    python src/hello_neutrino_ssd.py --arch mb2_ssd --delta 0.05 --dataset coco -r ~/PATH/TO/coco2017\n```\n\nTo optimize a `YOLOv5` model on [`VOC 2007 dataset`](http://host.robots.ox.ac.uk/pascal/VOC/), run the following,\n\n```{.python}\n    python src/hello_neutrino_yolo.py --arch yolo5_6s --delta 0.05 --dataset voc -r ~/PATH/TO/VOCdevkit\n```\n\nTo optimize a `YOLOv5` model on [`COCO dataset`](https://cocodataset.org/#home), run the following,\n\n```{.python}\n    python src/hello_neutrino_yolo.py --arch yolo5_6s --delta 0.05 --dataset coco -r ~/PATH/TO/coco2017\n```\n\nThe `delta` of 0.05 denotes the maximum affordable reduction in the mAP (Mean Average Precision) of the model during optimization. Feel free to play around with different object detection models and datasets, along with different `delta` values to get different optimized results. The `arch` and the `datasets` can be customized with any native PyTorch pretrained model.\n\n## Segmentation Models\n\nTo optimize a `U-Net` style model backend on [`VOC 2007 dataset`](http://host.robots.ox.ac.uk/pascal/VOC/), run the following,\n```{.python}\n    python src/hello_neutrino_unet.py --dataset voc --delta 0.02 --voc_path ~/PATH/TO/VOCdevkit\n```\n\nThe `delta` of 0.02 denotes the maximum affordable reduction in the mIOU (Mean Intersection over Union) of the model during optimization. Feel free to play around with different segmentation models and datasets, along with different `delta` values to get different optimized results. The `arch` and the `datasets` can be customized with any native PyTorch pretrained model.\n\n\n## Quantizing models for DLRT\nTo quantize a YOLO model for inference with DeepliteRT, run the following\n```\npython src/hello_neutrino_yolo_quantization.py --arch yolo5_6s --dataset voc -r ~/PATH/TO/VOCdevkit\n```\nTo improve latency at the risk of weaker model accuracy, add the `--conv11` flag to quantize 1x1 convolutions.\nTo improve the accuracy, try using the `--skip_layers_ratio` argument to skip quantization of the first x% of the convolution layers\n\nIf your model will process a different image resolution at runtime, pass it with `--runtime_resolution HxW` arguemnt. Ex: `--runtime_resolution 320x320`. This way the exported model\nwill accept images of the correct resolution.\n\n\n## Distributed Training\nTo setup Horovod for training with multiple GPUs, see the guide in the [documentation](https://docs.deeplite.ai/neutrino/samples.html?highlight=distributed#running-on-multi-gpu-on-a-single-machine) and make sure to pass argument `--horovod` to the example script. Note that Neutrino scales the learning rate by the number of GPUs, so passing a learning rate of 0.1 to Neutrino with 4 GPUs will apply a learning rate of 0.4 to the optimizer. \n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdeeplite%2Fneutrino-examples","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdeeplite%2Fneutrino-examples","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdeeplite%2Fneutrino-examples/lists"}