The deeplite-torch-zoo package is a collection of popular pretrained deep learning models and their datasets for PyTorch framework.
Project description
Deeplite Torch Zoo
The deeplite-torch-zoo
package is a collection of popular CNN model architectures and benchmark datasets for PyTorch. The models are grouped under different datasets and different task types such as classification, object detection, and semantic segmentation. The primary aim of deeplite-torch-zoo
is to booststrap applications by starting with the most suitable pretrained models for a given task. In addition, the pretrained models from deeplite-torch-zoo
can be used as a good starting point for optimizing model architectures using our neutrino_engine
Installation
Install using pip (release version)
Use following command to install the package from our internal PyPI repository.
$ pip install --upgrade pip
$ pip install deeplite-torch-zoo
Install from source (development version)
$ git clone https://github.com/Deeplite/deeplite-torch-zoo.git
$ pip install .
Install in dev mode
$ git clone https://github.com/Deeplite/deeplite-torch-zoo.git
$ pip install -e .
$ pip install -r requirements-test.txt
To test the installation, one can run the basic tests using pytest
command in the root folder.
How to Use
The deeplite-torch-zoo
is collection of benchmark computer vision datasets and pretrained models. There are three primary wrapper functions to load datasets, models and evaluation functions: get_data_splits_by_name
, get_model_by_name
, get_eval_function
which can be imported as
from deeplite_torch_zoo import get_data_splits_by_name
from deeplite_torch_zoo import get_model_by_name
from deeplite_torch_zoo import get_eval_function
Loading Datasets
The loaded datasets are available as a dictionary of the following format: {'train': train_dataloder, 'test': test_dataloader}
. The train_dataloder
and test_dataloader
are objects of torch.utils.data.DataLoader
.
Classification Datasets
data_splits = get_data_splits_by_name(
dataset_name="cifar100", model_name="resnet18", batch_size=128
)
The list of all available classification datasets can be found here.
Object Detection Datasets
The following sample code loads the PASCAL VOC dataset. train
contains the data loader for train sets for VOC2007
and/or VOC2012
. If both datasets are provided it concatenates both VOC2007
and VOC2012
train sets. Otherwise, it returns the train set for the provided dataset. 'test' contains dataloader (always with batch_size=1
) for test set based on VOC2007
. You also need to provide the model name as well.
data_splits = get_data_splits_by_name(
data_root=PATH_TO_VOCdevkit,
dataset_name="voc",
model_name="yolo3",
batch_size=BATCH_SIZE,
)
The list of all available object detection datasets can be found here.
NOTE: As it can be observed the data_loaders are provided based on the corresponding model (
model_name
). Different object detection models consider inputs/outputs in different formats, and thus the ourdata_splits
are formatted according to the needs of the model (e.g. for SSD or YOLO detection models).
Loading Models
Models are provided with weights pretrained on specific datasets. Thus, one could load a model X
pretrained on dataset Y
, for getting the appropriate weights.
Classification Models
model = get_model_by_name(
model_name="resnet18",
dataset_name="cifar100",
pretrained=True, # or False, if pretrained weights are not required
progress=False, # or True, if a progressbar is required
device="cpu", # or "gpu"
)
The list of all available classification models can be found here.
Object Detection Models
model = get_model_by_name(
model_name="vgg16_ssd",
dataset_name="voc",
pretrained=True, # or False, if pretrained weights are not required
progress=False, # or True, if a progressbar is required
)
The list of all available Object Detection models can be found here. One can also create a custom model based on existing architecture using this.
Available Models
There is an important utility function list_models
which can be imported as
from deeplite_torch_zoo import list_models
This utility will help in listing all available pretrained models or datasets.
For instance list_models("yolo5")
will provide the following result. Similar results can be obtained using list_models("yo")
.
+------------------+------------------------------------+
| Available models | Source datasets |
+==================+====================================+
| yolo5_6l | voc |
+------------------+------------------------------------+
| yolo5_6m | coco, voc |
+------------------+------------------------------------+
| yolo5_6m_relu | person_detection, voc |
+------------------+------------------------------------+
| yolo5_6ma | coco |
+------------------+------------------------------------+
| yolo5_6n | coco, person_detection, voc, voc07 |
+------------------+------------------------------------+
| yolo5_6n_hswish | coco |
+------------------+------------------------------------+
| yolo5_6n_relu | coco, person_detection, voc |
+------------------+------------------------------------+
| yolo5_6s | coco, person_detection, voc, voc07 |
+------------------+------------------------------------+
| yolo5_6s_relu | person_detection, voc |
+------------------+------------------------------------+
| yolo5_6sa | coco, person_detection |
+------------------+------------------------------------+
| yolo5_6x | voc |
+------------------+------------------------------------+
Train on Custom Dataset
Benchmark Results
Please refer to our documentation for the detailed performance metrics of the pretrained models available in the deeplite-torch-zoo
. After downloading a model, please evaluate the model using deeplite-profiler to verify the performance metric values. However, one may see different numbers for the execution time as the target hardware and/or the load on the system may impact it.
Contribute a Model/Dataset to the Zoo
NOTE: If you looking for an SDK documentation, please head over here.
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 for the detailed steps on how to add a model and dataset. In general, we follow the fork-and-pull
Git workflow.
- Fork the repo on GitHub
- Clone the project to your own machine
- Commit changes to your own branch
- Push your work back up to your fork
- 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
Object Detection
- The implementation of mb-ssd models: qfgaohao/pytorch-ssd
- The implementation of resnet-ssd: Nvidia-SSD
- The implementation of yolov5: ultralytics/yolov5
Segmentation
- The implementation of deeplab: pytorch-deeplab-xception
- The implementation of unet_scse: nyoki-mtl/pytorch-segmentation
- The implementation of fcn: wkentaro/pytorch-fcn
- The implementation of Unet: milesial/Pytorch-UNet
Classification
- The implementation of models on CIFAR100 dataset: kuangliu/pytorch-cifar
- The implementation of Mobilenetv1 model on VWW dataset: qfgaohao/pytorch-ssd
- The implementation of Mobilenetv3 model on VWW dataset: d-li14/mobilenetv3.pytorch
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distributions
Built Distributions
Hashes for deeplite_torch_zoo-1.2.7-py39-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 903b95a55274b3a2080a48697c8e04e9c75b2163705cfdacfc9e354373ce3293 |
|
MD5 | 9c4b5e5c8850d4a4bb14538613fab2dd |
|
BLAKE2b-256 | c88a5e261cfc5266715a1aa767ea28ef73bab5ba439c507f29e71e649ac84be8 |
Hashes for deeplite_torch_zoo-1.2.7-py38-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | e734f536f737402394b16bf4a52bcd828513c81acf296baaff75216e561a8cbc |
|
MD5 | 3965cc5e13e4a60877734f7a18757ac8 |
|
BLAKE2b-256 | fd9360329e986cc85a092c8cc58c1b8800615ce525e7aac0d78092628e343799 |
Hashes for deeplite_torch_zoo-1.2.7-py37-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | f0f203b4deaf51c644af31acd33edc849489b6314d5db9371b15482789065943 |
|
MD5 | 2078df3ff07a4c2538174958f17077e8 |
|
BLAKE2b-256 | 7286c4ade738d6e9d9aac47f5cf67eaa68c3c45fb0e64c6002b9cafa6ac00c51 |
Hashes for deeplite_torch_zoo-1.2.7-py36-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 488a42b9ff2c4f5afc891c1cb835b8ace847cdc9343a0ffdd850a8320793de35 |
|
MD5 | e72d34558f3159c6f9ab4eff0dba28d1 |
|
BLAKE2b-256 | 9850162344dda759e9cfb901964088af3da237917de40e43333a6e8387245cf6 |