CFM-Task-Models
Popular CV models modified for various approaches of Compression for Machines (aka Coding for Machines)
Installation
The easiest way to install CFM-Task-Models is through PyPI, to do this simply use pip install cfm-task-models
However, CFM-Task-Models has requirements that currently cannot be handled by pip, thus before using CFM-Task-Models for the first time please run miminstaller.py in your virutal environment. If using poetry consider:
poetry run python -m cfm_task_models.miminstaller
Requirements
CFM-Task-Models currently relies on several tools from OpenMMLab, which require custom installation using the openmim installer. Openmim is a tool provided by OpenMMLab which installs their libraries based on the user's pytorch and cuda versions.
See pyproject.toml for standard requirements and miminstaller.py for OpenMMLAB requirements
Using conda
conda env create -f environment.yml
Usage
To test Swin_Transformer, run the following command from the root directory:
python models/Swin-Transformer/models/swin_transformer_v2.py
Semantic Segmentation
Dataset
To downald the ADE20K dataset, run the following command from the root directory:
python cfm_task_models/dataset_download.py --dataset-name ade20k_2016 --save-dir data/ade --unzip --delete
Model Zoo
The model configs can be found in configs/segmentation.
ADE20K dataset
| Model | Backbone | config | checkpoint | mIoU | |
|---|---|---|---|---|---|
| UperNet | Swin-T | UPerNet | download model | 44.41 | |
| Mask2Former | Swin-T | Mask2Former | download model | 48.66 | |
| KNet + UperNet | Swin-T | KNet | download model | 45.84 |
Download from mim (#archive):
mim download mmsegmentation --config swin-tiny-patch4-window7-in1k-pre_upernet_8xb2-160k_ade20k-512x512 --dest ./configs/segmentation
mim download mmsegmentation --config mask2former_swin-t_8xb2-160k_ade20k-512x512 --dest ./configs/segmentation
mim download mmsegmentation --config knet-s3_swin-t_upernet_8xb2-adamw-80k_ade20k-512x512 --dest ./configs/segmentation
Evaluation
To evaluate the model on the ADE20K dataset, run the following command from the root directory:
python cfm_task_models/run_mmseg_swin_ade20k_eval.py --device cuda --checkpoint path/to/checkpoint --config path/to/config --output result/file/path --data-root path/to/data
For example :
python cfm_task_models/run_mmseg_swin_ade20k_eval.py --device cuda --checkpoint checkpoints/mask2former_swin-t_8xb2-160k_ade20k-512x512_20221203_234230-7d64e5dd.pth --config configs/segmentation/mask2former_swin-t_8xb2-160k_ade20k-512x512.py --output result.json --data-root /home/data/ade/ADEChallengeData2016/
Metadata
Release files for cfm-task-models 0.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| cfm_task_models-0.1.0.tar.gz | 1.1 MB | Without provenance | Details for cfm_task_models-0.1.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| cfm_task_models-0.1.0-py3-none-any.whl | Python 3 | none | any | Details for cfm_task_models-0.1.0-py3-none-any.whl |
Total release size: 2.2 MB
Release files / cfm_task_models-0.1.0.tar.gz
| Download URL | cfm_task_models-0.1.0.tar.gz |
|---|---|
| Size | 1.1 MB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
83229597ddc5022b5999ebd45cc566d2391d183dd47ee8746b1a4cbe7d4d2840
|
|
BLAKE2b-256 checksum How to use checksums |
e0ff85ba10bc711fdf0a6f2c29f5658133c19e0fab0e87abffe237c681a69028
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.8.3 CPython/3.10.6 Linux/5.15.0-117-generic
|
Release files / cfm_task_models-0.1.0-py3-none-any.whl
| Download URL | cfm_task_models-0.1.0-py3-none-any.whl |
|---|---|
| Size | 1.1 MB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
a2df3adf44d1d51a4d5a39da260aa1375d17db685810db97545f0ba9e0ec1654
|
|
BLAKE2b-256 checksum How to use checksums |
22d36ee7051d5111f0535fb6ebc0ee32eae91b858409d90b1c31697e90cae993
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.8.3 CPython/3.10.6 Linux/5.15.0-117-generic
|
Security for cfm-task-models 0.1.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.