Skip to main content

The toolkit for fast Deep Learning experiments in Computer Vision

Project description

TorchOk

The toolkit for fast Deep Learning experiments in Computer Vision

A day-to-day Computer Vision Engineer backpack

TorchOk is based on PyTorch and utilizes PyTorch Lightning for training pipeline routines.

The toolkit consists of:

  • Neural Network models which are proved to be the best not only on PapersWithCode but in practice. All models are under plug&play interface that easily connects backbones, necks and heads for reuse across tasks
  • Out-of-the-box support of common Computer Vision tasks: classification, segmentation, image representation and detection coming soon
  • Commonly used datasets, image augmentations and transformations (from Albumentations)
  • Fast implementations of retrieval metrics (with the help of FAISS and ranx) and lots of other metrics from torchmetrics
  • Export models to ONNX and ability to test the exported model without changing the datasets
  • All components can be customized inheriting the unified interfaces: Lightning's training loop, tasks, models, datasets, augmentations and transformations, metrics, loss functions, optimizers and LR schedulers
  • Training, validation and testing configurations are represented by YAML config files and managed by Hydra
  • Only straightforward training techniques are implemented. No whistles and bells

Installation

Conda

To remove previous installation of TorchOk environment, run:

conda remove --name torchok --all

To install TorchOk locally, run:

conda env create -f environment.yml

This will create a new conda environment torchok with all dependencies.

Docker

Another way to install TorchOk is through Docker. The built image supports SSH access, Jupyter Lab and Tensorboard ports exposing. If you don't need any of this, just omit the corresponding arguments. Build the image and run the container:

docker build -t torchok --build-arg SSH_PUBLIC_KEY="<public key>" .
docker run -d --name <username>_torchok --gpus=all -v <path/to/workdir>:/workdir -p <ssh_port>:22 -p <jupyter_port>:8888 -p <tensorboard_port>:6006 torchok

Getting started

The folder examples/configs contains YAML config files with some predefined training and inference configurations.

Train

For training example we can use the default configuration examples/configs/classification_cifar10.yml, where the CIFAR-10 dataset and the classification task are specified. The CIFAR-10 dataset will be automatically downloaded into your ~/.cache/torchok/data/cifar10 folder (341 MB).

To train on all available GPU devices (default config):

python train.py -cp examples/configs -cn classification_cifar10

To train on all available CPU cores:

train.py -cp examples/configs -cn classification_cifar10 trainer.accelerator='cpu'

During the training you can access the training and validation logs by starting a local TensorBoard:

tensorboard --logdir ~/.cache/torchok/logs/cifar10

Export to ONNX

TODO

Test ONNX model

TODO

Run tests

python -m unittest discover -s tests/ -p "test_*.py"

To be added soon (TODO)

Tasks

  • MOBY (unsupervised training)
  • DetectionTask
  • InstanceSegmentationTask

Backbones

  • Swin-v2
  • HRNet
  • ViT
  • EfficientNet
  • MobileNetV3

Segmentation models

  • HRNet neck + OCR head
  • U-Net neck

Detection models

  • YOLOR neck + head
  • DETR neck + head

Datasets

  • Stanford Online Products
  • Cityscapes
  • COCO

Losses

  • Pytorch Metric Learning losses
  • NT-ext (for unsupervised training)

Metrics

  • Segmentation IoU
  • Segmentation Dice
  • Detection metrics

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

torchok-0.4.2.tar.gz (51.0 kB view details)

Uploaded Source

Built Distribution

torchok-0.4.2-py3-none-any.whl (73.5 kB view details)

Uploaded Python 3

File details

Details for the file torchok-0.4.2.tar.gz.

File metadata

  • Download URL: torchok-0.4.2.tar.gz
  • Upload date:
  • Size: 51.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.1.14 CPython/3.9.12 Linux/5.10.102.1-microsoft-standard-WSL2

File hashes

Hashes for torchok-0.4.2.tar.gz
Algorithm Hash digest
SHA256 a0d8c7d72a1dc5ae26e7198d50a2d994d351e0ed5c6da38bb430a6e6113559a5
MD5 eeb1eb4c7298e5d9cc893ad7ce398e62
BLAKE2b-256 5c567757af6107f05f21c7e8698e2d2b27f01fa0871c835bccea01a0411355f6

See more details on using hashes here.

File details

Details for the file torchok-0.4.2-py3-none-any.whl.

File metadata

  • Download URL: torchok-0.4.2-py3-none-any.whl
  • Upload date:
  • Size: 73.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.1.14 CPython/3.9.12 Linux/5.10.102.1-microsoft-standard-WSL2

File hashes

Hashes for torchok-0.4.2-py3-none-any.whl
Algorithm Hash digest
SHA256 db9c7c5fbdbf532b4f7e0994b16e4787fb0a5bf0e91b2a0eff67de5b2fb5d6b2
MD5 e251a96edc0f8867c13ac465efbe6e44
BLAKE2b-256 d9c2b91943441bb908082df7247f09a9953fa964f89f7470d4375ef55b1318bc

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page