<div align="center">
![logo](https://docs.deeplite.ai/neutrino/_static/content/deeplite-logo-color.png)
**🚀 Deeplite Torch Zoo 🚀 is a collection of state-of-the-art efficient
computer vision models for embedded applications in [PyTorch](https://pytorch.org/).**
[![Build Status](https://travis-ci.com/Deeplite/deeplite-torch-zoo.svg?token=kodd5rKMpjxQDqRCxwiV&branch=master)](https://travis-ci.com/Deeplite/deeplite-torch-zoo) [![codecov](https://codecov.io/gh/Deeplite/deeplite-torch-zoo/branch/master/graph/badge.svg?token=AVTp3PW5UP)](https://codecov.io/gh/Deeplite/deeplite-torch-zoo)
</div>
**For information on YOLOBench, click [here](results/yolobench).**
The main features of this library are:
- High-level API to create models, dataloaders, and evaluation functions
- Single interface for SOTA classification models:
- [timm models](https://github.com/huggingface/pytorch-image-models/),
- [pytorchcv models](https://github.com/osmr/imgclsmob/tree/master/pytorch),
- other SOTA efficient models (EdgeViT, FasterNet, GhostNetV2, MobileOne)
- Single interface for SOTA YOLO detectors (compatible with [Ultralytics training](https://github.com/ultralytics/ultralytics)):
- YOLOv3, v4, v5, v6-3.0, v7, v8
- YOLO with timm backbones
- [other experimental configs](https://github.com/Deeplite/deeplite-torch-zoo/tree/develop/deeplite_torch_zoo/src/object_detection/yolov5/configs)
### 📋 Table of content
1. [Quick start](#start)
2. [Installation](#installation)
3. [Training scripts](#training-scripts)
7. [Contributing](#contributing)
9. [Credit](#credit)
### ⏳ Quick start <a name="start"></a>
#### Create a classification model
```python
from deeplite_torch_zoo import get_model, list_models
model = get_model(
model_name='edgevit_xs', # model names for imagenet available via `list_models('imagenet')`
dataset_name='imagenet', # dataset name, since resnet18 is different for e.g. imagenet and cifar100
pretrained=False, # if True, will try to load a pre-trained checkpoint
)
# creating a model with 42 classes for transfer learning:
model = get_model(
model_name='fasternet_t0', # model names for imagenet available via `list_models('imagenet')`
num_classes=42, # number of classes for transfer learning
dataset_name='imagenet', # take weights from checkpoint pre-trained on this dataset
pretrained=False, # if True, will try to load all weights with matching tensor shapes
)
```
#### Create an object detection model
```python
from deeplite_torch_zoo import get_model
model = get_model(
model_name='yolo4n', # creates a YOLOv4n model on COCO
dataset_name='coco', # (`n` corresponds to width factor 0.25, depth factor 0.33)
pretrained=False, # if True, will try to load a pre-trained checkpoint
)
# one could create a YOLO model with timm backbone,
# PAN neck and YOLOv8 decoupled anchor-free head like this:
model = get_model(
model_name='yolo_timm_fbnetv3_d', # creates a YOLO with FBNetV3-d backbone from timm
dataset_name='coco', #
pretrained=False, # if True, will try to load a pre-trained checkpoint
custom_head='v8', # will replace default detection head
# with YOLOv8 detection head
)
```
#### Create PyTorch dataloaders
```python
from deeplite_torch_zoo import get_dataloaders
dataloaders = get_dataloaders(
data_root='./', # folder with data, will be used for download
dataset_name='imagewoof', # datasets to if applicable,
num_workers=8, # number of dataloader workers
batch_size=64, # dataloader batch size (train and test)
)
# dataloaders['train'] -> train dataloader
# dataloaders['test'] -> test dataloader
#
# see below for the list of supported datasets
```
The list of supported datasets is available for [classification](https://github.com/Deeplite/deeplite-torch-zoo/blob/develop/docs/CLASSIFICATION.md) and [object detection](https://github.com/Deeplite/deeplite-torch-zoo/blob/develop/docs/OBJECT_DETECTION.md).
#### Creating an evaluation function
```python
from deeplite_torch_zoo import get_eval_function
eval_function = get_eval_function(
model_name='yolo8s',
dataset_name='voc',
)
# required arg signature is fixed for all eval functions
metrics = eval_function(model, test_dataloader)
```
#### (Experimental) Training with patched Ultralytics trainer
```python
from deeplite_torch_zoo.trainer import Detector
model = Detector(model_name='yolo7n') # will create a wrapper around YOLOv7n model
# (YOLOv7n model with YOLOv8 detection head)
model.train(data='VOC.yaml', epochs=100) # same arguments as Ultralytics trainer
```
### 🛠 Installation <a name="installation"></a>
PyPI version:
```bash
$ pip install deeplite-torch-zoo
````
Latest version from source:
```bash
$ pip install git+https://github.com/Deeplite/deeplite-torch-zoo.git
````
### 💪 Training scripts <a name="training-scripts"></a>
We provide several training scripts as an example of how `deeplite-torch-zoo` can be integrated into existing training pipelines:
- [modified timm ImageNet script](https://github.com/Deeplite/deeplite-torch-zoo/tree/develop/training_scripts/classification/imagenet)
- support for Knowledge Distillation
- training recipes provides (A1, A2, A3, [USI](https://github.com/Alibaba-MIIL/Solving_ImageNet), etc.)
- [modfied Ultralytics classification fine-tuning script](https://github.com/Deeplite/deeplite-torch-zoo/tree/develop/training_scripts/classification/ultralytics)
- [modfied Ultralytics YOLOv5 object detector training script](https://github.com/Deeplite/deeplite-torch-zoo/tree/develop/training_scripts/object_detection)
### 🤝 Contributing <a name="contributing"></a>
We always welcome community contributions to expand the scope of `deeplite-torch-zoo` and also to have additional new models and datasets. Please refer to the [documentation](https://docs.deeplite.ai/neutrino/zoo.html#contribute-a-model-dataset-to-the-zoo) for the detailed steps on how to add a model and dataset. In general, we follow the `fork-and-pull` Git workflow.
1. **Fork** the repo on GitHub
2. **Clone** the project to your own machine
3. **Commit** changes to your own branch
4. **Push** your work back up to your fork
5. Submit a **Pull request** so that we can review your changes
NOTE: Be sure to merge the latest from "upstream" before making a pull request!
## 🙏 Credit <a name="credit"></a>
<details>
<summary>Repositories used to build Deeplite Torch Zoo</summary>
### Object Detection
- YOLOv3 implementation: [ultralytics/yolov3](https://github.com/ultralytics/yolov3)
- YOLOv5 implementation: [ultralytics/yolov5](https://github.com/ultralytics/yolov5)
- flexible-yolov5 implementation: [Bobo-y/flexible-yolov5](https://github.com/Bobo-y/flexible-yolov5)
- YOLOv8 implementation: [ultralytics/ultralytics](https://github.com/ultralytics/ultralytics)
- YOLOv7 implementation: [WongKinYiu/yolov7](https://github.com/WongKinYiu/yolov7)
- YOLOX implementation: [iscyy/yoloair](https://github.com/iscyy/yoloair)
- [westerndigitalcorporation/YOLOv3-in-PyTorch](https://github.com/westerndigitalcorporation/YOLOv3-in-PyTorch)
### Segmentation
- The implementation of deeplab: [pytorch-deeplab-xception](https://github.com/jfzhang95/pytorch-deeplab-xception)
- The implementation of unet_scse: [nyoki-mtl/pytorch-segmentation](https://github.com/nyoki-mtl/pytorch-segmentation)
- The implementation of fcn: [wkentaro/pytorch-fcn](https://github.com/wkentaro/pytorch-fcn)
- The implementation of Unet: [milesial/Pytorch-UNet](https://github.com/milesial/Pytorch-UNet)
### Classification
- The implementation of models on CIFAR100 dataset: [kuangliu/pytorch-cifar](https://github.com/kuangliu/pytorch-cifar)
- The implementation of Mobilenetv1 model on VWW dataset: [qfgaohao/pytorch-ssd](https://github.com/qfgaohao/pytorch-ssd)
- The implementation of Mobilenetv3 model on VWW dataset: [d-li14/mobilenetv3.pytorch](https://github.com/d-li14/mobilenetv3.pytorch)
### DNN building block implementations
- [d-li14/mobilenetv2.pytorch](https://github.com/d-li14/mobilenetv2.pytorch)
- [d-li14/efficientnetv2.pytorch](https://github.com/d-li14/efficientnetv2.pytorch)
- [apple/ml-mobileone](https://github.com/apple/ml-mobileone)
- [osmr/imgclsmob](https://github.com/osmr/imgclsmob)
- [huggingface/pytorch-image-models](https://github1s.com/huggingface/pytorch-image-models)
- [moskomule/senet.pytorch](https://github.com/moskomule/senet.pytorch)
- [DingXiaoH/RepLKNet-pytorch](https://github.com/DingXiaoH/RepLKNet-pytorch)
- [huawei-noah/Efficient-AI-Backbones](https://github.com/huawei-noah/Efficient-AI-Backbones)
### Misc
- torchvision dataset implementations: [pytorch/vision](https://github.com/pytorch/vision)
- MLP implementation: [aaron-xichen/pytorch-playground](https://github.com/aaron-xichen/pytorch-playground)
- AutoAugment implementation: [DeepVoltaire/AutoAugment](https://github.com/DeepVoltaire/AutoAugment)
- Cutout implementation: [uoguelph-mlrg/Cutout](https://github.com/uoguelph-mlrg/Cutout)
- Robustness measurement image distortions: [hendrycks/robustness](https://github.com/hendrycks/robustness)
- Registry implementation: [openvinotoolkit/openvino/tools/pot](https://github.com/openvinotoolkit/openvino/blob/master/tools/pot)
</details>
Raw data
{
"_id": null,
"home_page": "https://github.com/Deeplite/deeplite-torch-zoo",
"name": "deeplite-torch-zoo",
"maintainer": "",
"docs_url": null,
"requires_python": "",
"maintainer_email": "",
"keywords": "deep_neural_network deep_learning zoo model datasets pytorch deeplite",
"author": "Deeplite",
"author_email": "support@deeplite.ai",
"download_url": "",
"platform": null,
"description": "<div align=\"center\">\n\n ![logo](https://docs.deeplite.ai/neutrino/_static/content/deeplite-logo-color.png)\n\n **\ud83d\ude80 Deeplite Torch Zoo \ud83d\ude80 is a collection of state-of-the-art efficient\n computer vision models for embedded applications in [PyTorch](https://pytorch.org/).**\n\n [![Build Status](https://travis-ci.com/Deeplite/deeplite-torch-zoo.svg?token=kodd5rKMpjxQDqRCxwiV&branch=master)](https://travis-ci.com/Deeplite/deeplite-torch-zoo) [![codecov](https://codecov.io/gh/Deeplite/deeplite-torch-zoo/branch/master/graph/badge.svg?token=AVTp3PW5UP)](https://codecov.io/gh/Deeplite/deeplite-torch-zoo)\n\n</div>\n\n**For information on YOLOBench, click [here](results/yolobench).**\n\nThe main features of this library are:\n\n - High-level API to create models, dataloaders, and evaluation functions\n - Single interface for SOTA classification models:\n - [timm models](https://github.com/huggingface/pytorch-image-models/),\n - [pytorchcv models](https://github.com/osmr/imgclsmob/tree/master/pytorch),\n - other SOTA efficient models (EdgeViT, FasterNet, GhostNetV2, MobileOne)\n - Single interface for SOTA YOLO detectors (compatible with [Ultralytics training](https://github.com/ultralytics/ultralytics)):\n - YOLOv3, v4, v5, v6-3.0, v7, v8\n - YOLO with timm backbones\n - [other experimental configs](https://github.com/Deeplite/deeplite-torch-zoo/tree/develop/deeplite_torch_zoo/src/object_detection/yolov5/configs)\n\n### \ud83d\udccb Table of content\n 1. [Quick start](#start)\n 2. [Installation](#installation)\n 3. [Training scripts](#training-scripts)\n 7. [Contributing](#contributing)\n 9. [Credit](#credit)\n\n\n### \u23f3 Quick start <a name=\"start\"></a>\n\n#### Create a classification model\n\n```python\nfrom deeplite_torch_zoo import get_model, list_models\n\nmodel = get_model(\n model_name='edgevit_xs', # model names for imagenet available via `list_models('imagenet')`\n dataset_name='imagenet', # dataset name, since resnet18 is different for e.g. imagenet and cifar100\n pretrained=False, # if True, will try to load a pre-trained checkpoint\n)\n\n# creating a model with 42 classes for transfer learning:\n\nmodel = get_model(\n model_name='fasternet_t0', # model names for imagenet available via `list_models('imagenet')`\n num_classes=42, # number of classes for transfer learning\n dataset_name='imagenet', # take weights from checkpoint pre-trained on this dataset\n pretrained=False, # if True, will try to load all weights with matching tensor shapes\n)\n```\n\n#### Create an object detection model\n\n```python\nfrom deeplite_torch_zoo import get_model\n\nmodel = get_model(\n model_name='yolo4n', # creates a YOLOv4n model on COCO\n dataset_name='coco', # (`n` corresponds to width factor 0.25, depth factor 0.33)\n pretrained=False, # if True, will try to load a pre-trained checkpoint\n)\n\n# one could create a YOLO model with timm backbone,\n# PAN neck and YOLOv8 decoupled anchor-free head like this:\n\nmodel = get_model(\n model_name='yolo_timm_fbnetv3_d', # creates a YOLO with FBNetV3-d backbone from timm\n dataset_name='coco', #\n pretrained=False, # if True, will try to load a pre-trained checkpoint\n custom_head='v8', # will replace default detection head\n # with YOLOv8 detection head\n)\n```\n\n#### Create PyTorch dataloaders\n\n```python\nfrom deeplite_torch_zoo import get_dataloaders\n\ndataloaders = get_dataloaders(\n data_root='./', # folder with data, will be used for download\n dataset_name='imagewoof', # datasets to if applicable,\n num_workers=8, # number of dataloader workers\n batch_size=64, # dataloader batch size (train and test)\n)\n\n# dataloaders['train'] -> train dataloader\n# dataloaders['test'] -> test dataloader\n#\n# see below for the list of supported datasets\n```\n\nThe list of supported datasets is available for [classification](https://github.com/Deeplite/deeplite-torch-zoo/blob/develop/docs/CLASSIFICATION.md) and [object detection](https://github.com/Deeplite/deeplite-torch-zoo/blob/develop/docs/OBJECT_DETECTION.md).\n\n#### Creating an evaluation function\n\n```python\nfrom deeplite_torch_zoo import get_eval_function\n\neval_function = get_eval_function(\n model_name='yolo8s',\n dataset_name='voc',\n)\n\n# required arg signature is fixed for all eval functions\nmetrics = eval_function(model, test_dataloader)\n```\n\n#### (Experimental) Training with patched Ultralytics trainer\n\n```python\nfrom deeplite_torch_zoo.trainer import Detector\n\nmodel = Detector(model_name='yolo7n') # will create a wrapper around YOLOv7n model\n # (YOLOv7n model with YOLOv8 detection head)\nmodel.train(data='VOC.yaml', epochs=100) # same arguments as Ultralytics trainer\n```\n\n### \ud83d\udee0 Installation <a name=\"installation\"></a>\nPyPI version:\n```bash\n$ pip install deeplite-torch-zoo\n````\nLatest version from source:\n```bash\n$ pip install git+https://github.com/Deeplite/deeplite-torch-zoo.git\n````\n\n### \ud83d\udcaa Training scripts <a name=\"training-scripts\"></a>\n\nWe provide several training scripts as an example of how `deeplite-torch-zoo` can be integrated into existing training pipelines:\n\n\n- [modified timm ImageNet script](https://github.com/Deeplite/deeplite-torch-zoo/tree/develop/training_scripts/classification/imagenet)\n\n - support for Knowledge Distillation\n - training recipes provides (A1, A2, A3, [USI](https://github.com/Alibaba-MIIL/Solving_ImageNet), etc.)\n- [modfied Ultralytics classification fine-tuning script](https://github.com/Deeplite/deeplite-torch-zoo/tree/develop/training_scripts/classification/ultralytics)\n- [modfied Ultralytics YOLOv5 object detector training script](https://github.com/Deeplite/deeplite-torch-zoo/tree/develop/training_scripts/object_detection)\n\n\n### \ud83e\udd1d Contributing <a name=\"contributing\"></a>\n\nWe always welcome community contributions to expand the scope of `deeplite-torch-zoo` and also to have additional new models and datasets. Please refer to the [documentation](https://docs.deeplite.ai/neutrino/zoo.html#contribute-a-model-dataset-to-the-zoo) for the detailed steps on how to add a model and dataset. In general, we follow the `fork-and-pull` Git workflow.\n\n 1. **Fork** the repo on GitHub\n 2. **Clone** the project to your own machine\n 3. **Commit** changes to your own branch\n 4. **Push** your work back up to your fork\n 5. Submit a **Pull request** so that we can review your changes\n\nNOTE: Be sure to merge the latest from \"upstream\" before making a pull request!\n\n## \ud83d\ude4f Credit <a name=\"credit\"></a>\n\n<details>\n\n <summary>Repositories used to build Deeplite Torch Zoo</summary>\n\n### Object Detection\n- YOLOv3 implementation: [ultralytics/yolov3](https://github.com/ultralytics/yolov3)\n- YOLOv5 implementation: [ultralytics/yolov5](https://github.com/ultralytics/yolov5)\n- flexible-yolov5 implementation: [Bobo-y/flexible-yolov5](https://github.com/Bobo-y/flexible-yolov5)\n- YOLOv8 implementation: [ultralytics/ultralytics](https://github.com/ultralytics/ultralytics)\n- YOLOv7 implementation: [WongKinYiu/yolov7](https://github.com/WongKinYiu/yolov7)\n- YOLOX implementation: [iscyy/yoloair](https://github.com/iscyy/yoloair)\n- [westerndigitalcorporation/YOLOv3-in-PyTorch](https://github.com/westerndigitalcorporation/YOLOv3-in-PyTorch)\n\n### Segmentation\n- The implementation of deeplab: [pytorch-deeplab-xception](https://github.com/jfzhang95/pytorch-deeplab-xception)\n- The implementation of unet_scse: [nyoki-mtl/pytorch-segmentation](https://github.com/nyoki-mtl/pytorch-segmentation)\n- The implementation of fcn: [wkentaro/pytorch-fcn](https://github.com/wkentaro/pytorch-fcn)\n- The implementation of Unet: [milesial/Pytorch-UNet](https://github.com/milesial/Pytorch-UNet)\n\n### Classification\n- The implementation of models on CIFAR100 dataset: [kuangliu/pytorch-cifar](https://github.com/kuangliu/pytorch-cifar)\n- The implementation of Mobilenetv1 model on VWW dataset: [qfgaohao/pytorch-ssd](https://github.com/qfgaohao/pytorch-ssd)\n- The implementation of Mobilenetv3 model on VWW dataset: [d-li14/mobilenetv3.pytorch](https://github.com/d-li14/mobilenetv3.pytorch)\n\n### DNN building block implementations\n- [d-li14/mobilenetv2.pytorch](https://github.com/d-li14/mobilenetv2.pytorch)\n- [d-li14/efficientnetv2.pytorch](https://github.com/d-li14/efficientnetv2.pytorch)\n- [apple/ml-mobileone](https://github.com/apple/ml-mobileone)\n- [osmr/imgclsmob](https://github.com/osmr/imgclsmob)\n- [huggingface/pytorch-image-models](https://github1s.com/huggingface/pytorch-image-models)\n- [moskomule/senet.pytorch](https://github.com/moskomule/senet.pytorch)\n- [DingXiaoH/RepLKNet-pytorch](https://github.com/DingXiaoH/RepLKNet-pytorch)\n- [huawei-noah/Efficient-AI-Backbones](https://github.com/huawei-noah/Efficient-AI-Backbones)\n\n\n### Misc\n- torchvision dataset implementations: [pytorch/vision](https://github.com/pytorch/vision)\n- MLP implementation: [aaron-xichen/pytorch-playground](https://github.com/aaron-xichen/pytorch-playground)\n- AutoAugment implementation: [DeepVoltaire/AutoAugment](https://github.com/DeepVoltaire/AutoAugment)\n- Cutout implementation: [uoguelph-mlrg/Cutout](https://github.com/uoguelph-mlrg/Cutout)\n- Robustness measurement image distortions: [hendrycks/robustness](https://github.com/hendrycks/robustness)\n- Registry implementation: [openvinotoolkit/openvino/tools/pot](https://github.com/openvinotoolkit/openvino/blob/master/tools/pot)\n\n</details>\n",
"bugtrack_url": null,
"license": "Multi-licensing",
"summary": "The deeplite-torch-zoo package is a collection of popular pretrained deep learning models and their datasets for PyTorch framework.",
"version": "2.0.2",
"project_urls": {
"Homepage": "https://github.com/Deeplite/deeplite-torch-zoo"
},
"split_keywords": [
"deep_neural_network",
"deep_learning",
"zoo",
"model",
"datasets",
"pytorch",
"deeplite"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "7e39473d154ff97239ca6038678c618e1ad11d96bb6ecb2a935e6017f25dd5bb",
"md5": "ea1f4e7a397fea77d15d09dec6299299",
"sha256": "4eedd0cace3744258de815987cb932a05dd4151e3e38ced1252a33db93d8b66a"
},
"downloads": -1,
"filename": "deeplite_torch_zoo-2.0.2-py37-none-any.whl",
"has_sig": false,
"md5_digest": "ea1f4e7a397fea77d15d09dec6299299",
"packagetype": "bdist_wheel",
"python_version": "py37",
"requires_python": null,
"size": 356968,
"upload_time": "2023-08-30T01:03:14",
"upload_time_iso_8601": "2023-08-30T01:03:14.624424Z",
"url": "https://files.pythonhosted.org/packages/7e/39/473d154ff97239ca6038678c618e1ad11d96bb6ecb2a935e6017f25dd5bb/deeplite_torch_zoo-2.0.2-py37-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "c3c5ec70f65778bdac278c8f5ac8e95d900b8908e76b1e5198df95fbc34e9e0b",
"md5": "09b3cfab4e8f24fb628806bc742c7f0c",
"sha256": "c03b52ecca6ae7eaf1256542402cb974ca691acecb2eb06d06ae29f99930da86"
},
"downloads": -1,
"filename": "deeplite_torch_zoo-2.0.2-py39-none-any.whl",
"has_sig": false,
"md5_digest": "09b3cfab4e8f24fb628806bc742c7f0c",
"packagetype": "bdist_wheel",
"python_version": "py39",
"requires_python": null,
"size": 356969,
"upload_time": "2023-08-30T01:03:41",
"upload_time_iso_8601": "2023-08-30T01:03:41.064002Z",
"url": "https://files.pythonhosted.org/packages/c3/c5/ec70f65778bdac278c8f5ac8e95d900b8908e76b1e5198df95fbc34e9e0b/deeplite_torch_zoo-2.0.2-py39-none-any.whl",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2023-08-30 01:03:14",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "Deeplite",
"github_project": "deeplite-torch-zoo",
"travis_ci": true,
"coveralls": false,
"github_actions": false,
"lcname": "deeplite-torch-zoo"
}