{"id":13738388,"url":"https://github.com/eora-ai/torchok","last_synced_at":"2025-05-08T16:33:51.013Z","repository":{"id":37925724,"uuid":"416085410","full_name":"eora-ai/torchok","owner":"eora-ai","description":"Production-oriented Computer Vision models training pipeline for common tasks: classification, segmentation, detection and representation🥤","archived":false,"fork":false,"pushed_at":"2023-06-15T18:15:39.000Z","size":58801,"stargazers_count":54,"open_issues_count":24,"forks_count":6,"subscribers_count":6,"default_branch":"main","last_synced_at":"2024-10-13T19:37:26.552Z","etag":null,"topics":["computer-vision","deep-learning","image-classification","image-retrieval","image-segmentation","representation-learning"],"latest_commit_sha":null,"homepage":"https://torchok.readthedocs.org","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/eora-ai.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null}},"created_at":"2021-10-11T21:01:32.000Z","updated_at":"2024-09-29T10:23:01.000Z","dependencies_parsed_at":"2023-12-15T21:35:38.510Z","dependency_job_id":null,"html_url":"https://github.com/eora-ai/torchok","commit_stats":{"total_commits":878,"total_committers":11,"mean_commits":79.81818181818181,"dds":0.7517084282460137,"last_synced_commit":"1fa6f2489f8d1e7b574f7c8114b386c0ab622883"},"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eora-ai%2Ftorchok","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eora-ai%2Ftorchok/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eora-ai%2Ftorchok/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eora-ai%2Ftorchok/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/eora-ai","download_url":"https://codeload.github.com/eora-ai/torchok/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":224746683,"owners_count":17363092,"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":["computer-vision","deep-learning","image-classification","image-retrieval","image-segmentation","representation-learning"],"created_at":"2024-08-03T03:02:20.877Z","updated_at":"2024-11-15T07:30:59.820Z","avatar_url":"https://github.com/eora-ai.png","language":"Python","funding_links":[],"categories":["Python"],"sub_categories":[],"readme":"\u003cdiv align=\"center\"\u003e\n\n\u003cimg src=\"https://i.imgur.com/cpwsBrY.png\" alt=\"TorchOk\" style=\"width:300px; horizontal-align:middle\"/\u003e\n\n**The toolkit for fast Deep Learning experiments in Computer Vision**\n\n\u003c/div\u003e\n\n## A day-to-day Computer Vision Engineer backpack\n\n[![Build Status](https://github.com/eora-ai/torchok/actions/workflows/flake8_checks.yaml/badge.svg?branch=main)](https://github.com/eora-ai/torchok/actions/workflows/flake8_checks.yaml)\n\nTorchOk is based on [PyTorch](https://github.com/pytorch/pytorch) and utilizes [PyTorch Lightning](https://github.com/PyTorchLightning/pytorch-lightning) for training pipeline routines.\n\nThe toolkit consists of:\n- Neural Network models which are proved to be the best not only on [PapersWithCode](https://paperswithcode.com/) but in practice. All models are under plug\u0026play interface that easily connects backbones, necks and heads for reuse across tasks\n- Out-of-the-box support of common Computer Vision tasks: classification, segmentation, image representation and detection coming soon\n- Commonly used datasets, image augmentations and transformations (from [Albumentations](https://albumentations.ai/))\n- Fast implementations of retrieval metrics (with the help of [FAISS](https://github.com/facebookresearch/faiss) and [ranx](https://github.com/AmenRa/ranx)) and lots of other metrics from [torchmetrics](https://torchmetrics.readthedocs.io/)\n- Export models to ONNX and the ability to test the exported model without changing the datasets\n- All components can be customized by inheriting the unified interfaces: Lightning's training loop, tasks, models, datasets, augmentations and transformations, metrics, loss functions, optimizers and LR schedulers\n- Training, validation and testing configurations are represented by YAML config files and managed by [Hydra](https://hydra.cc/)\n- Only straightforward training techniques are implemented. No whistles and bells\n\n## Installation\n### pip\nInstallation via pip can be done in two steps:\n1. Install PyTorch that meets your hardware requirements via [official instructions](https://pytorch.org/get-started/locally/)\n2. Install TorchOk by running `pip install --upgrade torchok`\n### Conda\nTo remove the previous installation of TorchOk environment, run:\n```bash\nconda remove --name torchok --all\n```\nTo install TorchOk locally, run:\n```bash\nconda env create -f environment.yml\n```\nThis will create a new conda environment **torchok** with all dependencies.\n### Docker\nAnother 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:\n```bash\ndocker build -t torchok --build-arg SSH_PUBLIC_KEY=\"\u003cpublic key\u003e\" .\ndocker run -d --name \u003cusername\u003e_torchok --gpus=all -v \u003cpath/to/workdir\u003e:/workdir -p \u003cssh_port\u003e:22 -p \u003cjupyter_port\u003e:8888 -p \u003ctensorboard_port\u003e:6006 torchok\n```\n\n## Getting started\nThe folder `examples/configs` contains YAML config files with some predefined training and inference configurations.\n### Train\nFor a 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).\n\n**To train on all available GPU devices (default config):**\n```bash\npython -m torchok -cp ../examples/configs -cn classification_cifar10\n```\n**To train on all available CPU cores:**\n```bash\npython -m torchok -cp ../examples/configs -cn classification_cifar10 trainer.accelerator='cpu'\n```\nDuring the training you can access the training and validation logs by starting a local TensorBoard:\n```bash\ntensorboard --logdir ~/.cache/torchok/logs/cifar10\n```\n### Find learning rate\nTo automatically find the initial learning rate, we use Pytorch Lightning tuner which algorithm based on [Cyclical Learning Rates for Training Neural Networks](https://arxiv.org/abs/1506.01186) the article.\n```bash\npython -m torchok -cp ../examples/configs -cn classification_cifar10 +mode=find_lr\n```\n\n### Export to ONNX\nTODO\n### Run ONNX model\nFor the ONNX model run, we can use the `examples/configs/onnx_infer.yaml`.\nBut first we need to define the field `path_to_onnx`.\n\n**To test ONNX model:**\n```bash\npython test.py -cp examples/configs -cn onnx_infer +mode=test\n```\n\n**To predict ONNX model:**\n```bash\npython test.py -cp examples/configs -cn onnx_infer +mode=predict\n```\n\n## Run tests\n```bash\npython -m unittest discover -s tests/ -p \"test_*.py\"\n```\n## To be added soon (TODO)\nTasks\n=====\n* MOBY (unsupervised training)\n* InstanceSegmentationTask\n\nDetection models\n================\n* YOLOR neck + head\n* DETR neck + head\n\nDatasets\n========\n* ImageNet\n* Cityscapes\n\nLosses\n======\n* Pytorch Metric Learning losses\n* NT-ext (for unsupervised training)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Feora-ai%2Ftorchok","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Feora-ai%2Ftorchok","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Feora-ai%2Ftorchok/lists"}