{"id":51605939,"url":"https://github.com/anto18671/coco-pretraining","last_synced_at":"2026-07-12T02:01:52.167Z","repository":{"id":362190650,"uuid":"1237736660","full_name":"anto18671/coco-pretraining","owner":"anto18671","description":"Train a Mask R-CNN instance segmentation model on the COCO 2017 dataset using a timm ConvNeXt-Tiny backbone.","archived":false,"fork":false,"pushed_at":"2026-05-13T13:50:05.000Z","size":7,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2026-06-03T04:33:42.753Z","etag":null,"topics":["coco","machine-learning","mask-rcnn","pretraining","segmentation"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/anto18671.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,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2026-05-13T13:11:14.000Z","updated_at":"2026-05-13T14:11:03.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/anto18671/coco-pretraining","commit_stats":null,"previous_names":["anto18671/coco-pretraining"],"tags_count":null,"template":false,"template_full_name":null,"purl":"pkg:github/anto18671/coco-pretraining","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/anto18671%2Fcoco-pretraining","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/anto18671%2Fcoco-pretraining/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/anto18671%2Fcoco-pretraining/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/anto18671%2Fcoco-pretraining/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/anto18671","download_url":"https://codeload.github.com/anto18671/coco-pretraining/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/anto18671%2Fcoco-pretraining/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":35379591,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-07-12T02:00:06.386Z","response_time":87,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":["coco","machine-learning","mask-rcnn","pretraining","segmentation"],"created_at":"2026-07-12T02:01:51.445Z","updated_at":"2026-07-12T02:01:52.142Z","avatar_url":"https://github.com/anto18671.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# COCO Mask R-CNN Pretraining\n\nTrain a Mask R-CNN instance segmentation model on the COCO 2017 dataset using a `timm` ConvNeXt-Tiny backbone.\n\nThis project loads COCO image annotations with `pycocotools`, builds a TorchVision `MaskRCNN` model, trains on the COCO train split, validates on the COCO val split, and saves latest, epoch, best, and final checkpoints.\n\n## Features\n\n- COCO 2017 instance segmentation training\n- ConvNeXt-Tiny backbone from `timm`\n- TorchVision Mask R-CNN detection head\n- Train and validation loss tracking\n- Progress bars with `tqdm`\n- Automatic checkpoint saving\n- Basic dataset path validation with clear file errors\n\n## Project Structure\n\n```text\ncoco-pretraining/\n  train.py\n  README.md\n  LICENSE\n  .gitignore\n  data/\n    annotations_trainval2017/\n      annotations/\n        instances_train2017.json\n        instances_val2017.json\n    train2017/\n      train2017/\n        *.jpg\n    val2017/\n      val2017/\n        *.jpg\n```\n\n## Dataset\n\nDataset used: [COCO 2017 from Kaggle](https://www.kaggle.com/datasets/sabahesaraki/2017-2017)\n\nAfter downloading and extracting the dataset, make sure the folders match the layout above. The training script expects these paths:\n\n```text\ndata/annotations_trainval2017/annotations/instances_train2017.json\ndata/annotations_trainval2017/annotations/instances_val2017.json\ndata/train2017/train2017/\ndata/val2017/val2017/\n```\n\nThe `data/` folder is ignored by Git because the dataset is large.\n\n## Installation\n\nCreate and activate a virtual environment:\n\n```bash\npython -m venv .venv\n```\n\nOn Windows PowerShell:\n\n```powershell\n.\\.venv\\Scripts\\Activate.ps1\n```\n\nInstall the required packages:\n\n```bash\npip install torch torchvision timm opencv-python numpy pycocotools tqdm\n```\n\nFor GPU training, install the PyTorch build that matches your CUDA version from the official PyTorch installation guide.\n\n## Training\n\nRun:\n\n```bash\npython train.py\n```\n\nCurrent training configuration in `train.py`:\n\n```text\nBackbone:       convnext_tiny\nImage size:     512 x 512\nBatch size:     6\nEpochs:         10\nLearning rate:  1e-4\nWorkers:        3\nClasses:        91\nDevice:         CUDA if available, otherwise CPU\n```\n\nYou can adjust these values near the top of `train.py`.\n\n## Outputs\n\nThe script saves checkpoints in the project root:\n\n```text\nmaskrcnn_latest.pth\nmaskrcnn_epoch_1.pth\nmaskrcnn_epoch_2.pth\n...\nmaskrcnn_best.pth\nmaskrcnn_final.pth\n```\n\n`maskrcnn_best.pth` is saved when validation loss improves. `maskrcnn_final.pth` contains the final model state dictionary after training completes.\n\n## Notes\n\n- Full COCO training is compute intensive and is strongly recommended on a CUDA-capable GPU.\n- COCO category IDs go up to 90, so the script uses `NUM_CLASSES = 91`.\n- Images are resized to `512 x 512` before training.\n- Checkpoints can become large, so avoid committing `.pth` files to GitHub.\n\n## License\n\nThis project is licensed under the terms of the included [LICENSE](LICENSE).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fanto18671%2Fcoco-pretraining","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fanto18671%2Fcoco-pretraining","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fanto18671%2Fcoco-pretraining/lists"}