{"id":22170276,"url":"https://github.com/ayushexel/trolo","last_synced_at":"2025-10-06T12:03:14.271Z","repository":{"id":265632910,"uuid":"891177318","full_name":"AyushExel/trolo","owner":"AyushExel","description":"An SDK for Transformers + YOLO and other SSD family models","archived":false,"fork":false,"pushed_at":"2025-01-24T20:25:18.000Z","size":14996,"stargazers_count":59,"open_issues_count":8,"forks_count":11,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-03-31T19:21:26.960Z","etag":null,"topics":["computer-vision","object-detection","opencv","segmentation","transformers","yolo"],"latest_commit_sha":null,"homepage":"https://ayushexel.github.io/trolo/intro","language":"Jupyter Notebook","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/AyushExel.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,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-11-19T21:34:57.000Z","updated_at":"2025-03-01T08:01:00.000Z","dependencies_parsed_at":"2025-02-10T03:01:28.076Z","dependency_job_id":null,"html_url":"https://github.com/AyushExel/trolo","commit_stats":null,"previous_names":["ayushexel/trolo"],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AyushExel%2Ftrolo","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AyushExel%2Ftrolo/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AyushExel%2Ftrolo/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AyushExel%2Ftrolo/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/AyushExel","download_url":"https://codeload.github.com/AyushExel/trolo/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":253165209,"owners_count":21864394,"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","object-detection","opencv","segmentation","transformers","yolo"],"created_at":"2024-12-02T06:44:53.284Z","updated_at":"2025-10-06T12:03:14.166Z","avatar_url":"https://github.com/AyushExel.png","language":"Jupyter Notebook","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003cimg width=\"838\" alt=\"387845954-73311b13-a624-4736-8472-b22318bcd6b0\" src=\"https://github.com/user-attachments/assets/08091cad-703d-4d7d-84f6-5e6c310bf6c2\"\u003e\n\n\u003cdiv align=\"center\"\u003e\n  \u003ca href=\"https://colab.research.google.com/github/ayushexel/trolo/blob/master/recipes/quickstart.ipynb\"\u003e\n    \u003cimg src=\"https://colab.research.google.com/assets/colab-badge.svg\" alt=\"Open In Colab\"/\u003e\n  \u003c/a\u003e\n  \u003ca href=\"https://ayushexel.github.io/trolo/intro/\"\u003e\n    \u003cimg src=\"https://img.shields.io/badge/docs-online-green.svg\" alt=\"Documentation\"/\u003e\n  \u003c/a\u003e\n\u003c/div\u003e\n\n# Trolo\n![pred_0](https://github.com/user-attachments/assets/144ae351-c520-4640-8081-3e9a0db9b432)\n\nA framework for harnessing the power of transformers with YOLO models and other single-shot detectors!\n\n\u003e **Note**: This is an early release. The package is under active development. Please report any issues and I'll try to fix them ASAP.\n\nQuickstart on Colab: [![Open In Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/ayushexel/trolo/blob/master/recipes/quickstart.ipynb)\n\n🔥 **NEW** 🔥 D-Fine models are now available. Inspired by RT-DETR outperform all real-time detectors including YOLO-series models\n\u003cimg src=\"https://raw.githubusercontent.com/Peterande/storage/master/figs/stats_padded.png\" alt=\"D-FINE Model Stats\" width=\"1024\"\u003e\n\n## Installation\n\n```bash\npip install trolo\n```\n\n\n## Features\n\n- 🔥 Transformer-enhanced object detection\n- 🎯 Single-shot detection capabilities  \n- ⚡ High performance inference\n- 🛠️ Easy to use CLI interface\n- 🚀 Fast video stream inference\n- 🧠 Automatic DDP handling\n\n\n## Available Models\n\n\u003cdetails open\u003e\n\u003csummary\u003e\u003cb\u003eD-FINE\u003c/b\u003e\u003c/summary\u003e\n\nThe D-FINE model redefines regression tasks in DETR-based detectors using Fine-grained Distribution Refinement (FDR).\n[Official Paper](https://arxiv.org/abs/2410.13842) | [Official Repo](https://github.com/Peterande/D-FINE)\n![D-FINE Model Stats](https://raw.githubusercontent.com/Peterande/storage/master/figs/stats_padded.png)\n\u003c/details\u003e\n\n( All models will be automatically downloaded when you pass the name for any task)\n\n| Model | Dataset | AP\u003csup\u003eval\u003c/sup\u003e | #Params | Latency | GFLOPs |\n| :---: | :---: | :---: |  :---: | :---: | :---: |\n`dfine-n` | COCO | **42.8** | 4M | 2.12ms | 7\n`dfine-s` | COCO | **48.5** | 10M | 3.49ms | 25\n`dfine-m` | COCO | **52.3** | 19M | 5.62ms | 57\n`dfine-l` | COCO | **54.0** | 31M | 8.07ms | 91\n`dfine-x` | COCO | **55.8** | 62M | 12.89ms | 202\n\n\n\n\u003cdetails\u003e\n\u003csummary\u003e\u003cb\u003eRT-DETR v3 (Coming Soon)\u003c/b\u003e\u003c/summary\u003e\n\u003c/details\u003e\n\n\u003cdetails\u003e\n\u003csummary\u003e\u003cb\u003eRT-DETR v2 (Coming Soon)\u003c/b\u003e\u003c/summary\u003e\n\u003c/details\u003e\n\n\u003cdetails\u003e\n\u003csummary\u003e\u003cb\u003eTrolo-2024 (WIP)\u003c/b\u003e\u003c/summary\u003e\n\u003c/details\u003e\n\n\n## Quick Start\n\n\nThe CLI command structure is:\n\n```bash\ntrolo [command] [options]\n```\nFor detailed help:\n```bash\ntrolo --help # for general help\ntrolo [command] --help # for command-specific help\n```\n\n### Inference\n\nExample inference command:\n```bash\ntrolo predict --model dfine-n # automatically downloads model from trolo model hub\n```\nSupport for single image, image folder, and video input\n```bash\ntrolo predict --model dfine-n.pth --input img.jpg # folder/ or video.mp4 or 0 (for webcam)\n```\n\n🔥 Smart Video stream inference - infers on videos in streaming mode so you never have to worry about memory issues!\n\nPython API:\n```python\nfrom trolo.inference import DetectionPredictor\n\npredictor = DetectionPredictor(model=\"dfine-n\")\npredictions = predictor.predict() # get predictions\npoltted_preds = predictor.visualize(show=True, save=True) # or get visualized outputs\n```\nVisit Inference Docs for more details\n\n\n  \n### Model export    \n Example export command: \n ```bash \n trolo export --model dfine-n --export_format onnx --input_size 640  \n ```\n  Python API: \n  \n```\npython from trolo.inference import ModelExporter model_path = \"/path/to/model\"  \ninput_size = 640 # Inference resolution  \nexport_format = \"onnx\"  \nexporter = ModelExporter(model=model_path) exporter.export(input_size=input_size, export_format=export_format)  \n``` \nVisit Export Docs for more details. \nPlease check [deployment](https://github.com/AyushExel/trolo/tree/master/recipes/deployment) for inference script for various deployment.\n\n\n### Training\n\u003cb\u003eExample training command:\u003c/b\u003e\n```bash\ntrolo train --config dfine_n # automatically find the config file\n```\n\n🔥 Automatically handle DDP by simply passing the GPUs to the CLI\n```bash\ntrolo train --config dfine_n --device 0,1,2,3 \n```\nThat's it!\n\n\u003cb\u003ePython API\u003c/b\u003e\n\n```python\nfrom trolo.trainers import DetectionTrainer\n\ntrainer = DetectionTrainer(config=\"dfine_n\") # or pass custom config path\ntrainer.train() # pass device = 0,1,2,3 to automatically handle DDP \n```\n\nVisit Training Docs for more details\n\n## Docker 🐳 Usage Guide\n\n\u003cdetails\u003e\n\u003csummary\u003e   Build and Run Options \u003c/summary\u003e\n\n### Build Commands\n```bash\n# Standard build\ndocker build -t trolo .\n\n# Build with a specific tag\ndocker build -t trolo:v1 .\n\n# Build with build arguments (if needed)\ndocker build --build-arg SOME_ARG=value -t trolo .\n```\n\n### Run Commands\n\n#### 1. Basic Run (No GPU, No Volume)\n```bash\ndocker run -it --name containaer_name  trolo\n```\n\n#### 2. Run with GPU Mounting\n```bash\ndocker run -it --gpus  --name containaer_name  all trolo\n```\n\n#### 3. Run with Volume Mounting\n```bash\ndocker run -it -v /local/path/on/host:/workspace/app/trolo --name containaer_name trolo\n```\n\n#### 4. Comprehensive Run (GPU and Volume)\n```bash\ndocker run -it --gpus all -v /local/path/on/host:/workspace/app/trolo --name containaer_name  trolo\n```\n\n#### 5. Additional Run Options\n```bash\n# Run with custom entrypoint\ndocker run -it --entrypoint /bin/bash trolo\n\n# Run with environment variables\ndocker run -it -e CUSTOM_ENV=value trolo\n\n# Run in detached mode\ndocker run -d trolo\n```\n\n#### Notes:\n- Replace `/local/path/on/host` with your actual host path\n- `--gpus all` requires NVIDIA Container Toolkit\n- Volume mounting allows persistent data and code modifications\n\u003c/details\u003e\n\n\n## Totally open source and free\n\nTLDR: This is a non-profit project.Use it, modify it, copy it, do whatever you want with it. And if something doesn't allow you to do that, please open an issue.\n\n\u003cdetails open\u003e\n\u003csummary\u003eMore details\u003c/summary\u003e\n\n* Apache 2.0\n\n* The license has simply been copied from official apache repo. Please open an issue if something doesn't allow you to use it. \n* This project is built on top of open licensed projects as mentioned below.\n* I intend to keep this project free and open source FOREVER. There are no plans for direct/indirect monetization of this project. I only accept sponsorships for compute resources to train models and perform independent research.\n\u003c/details\u003e\n\n## Credits\n\nThis project builds upon several excellent open source projects:\n\n- [D-FINE](https://github.com/Peterande/D-FINE): Original D-FINE model implementation\n- [RT-DETR](https://github.com/lyuwenyu/RT-DETR): Real-time DETR architecture\n- [PaddlePaddle](https://github.com/PaddlePaddle/PaddleDetection): Detection framework\n\u003c/details\u003e\n\n\u003cdetails\u003e\n\u003csummary\u003eMore details\u003c/summary\u003e\n- The original trainer is based on D-fine with major modifications for handling pre-trained weights, DDP, and other features.\n- The architecture is for D-fine is same as the original paper and repo. \n\u003c/details\u003e\n\n\n## Contributing\n\nContributions are most welcome! Please feel free to submit a Pull Request.\n\n---\n\n**Note**: This is an early work in progress. Many features are still under development.\n\n### Immidiate TODOs\n- [ ] Docusaurus documentation\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fayushexel%2Ftrolo","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fayushexel%2Ftrolo","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fayushexel%2Ftrolo/lists"}