{"id":15957062,"url":"https://github.com/chunml/ssd-pytorch","last_synced_at":"2025-03-26T09:32:23.233Z","repository":{"id":99122918,"uuid":"189943317","full_name":"ChunML/ssd-pytorch","owner":"ChunML","description":"Source code for the upcoming SSD tutorial series. This project uses Pytorch will be kept as straight-forward as possible.","archived":false,"fork":false,"pushed_at":"2019-06-11T06:33:22.000Z","size":39,"stargazers_count":3,"open_issues_count":0,"forks_count":3,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-03-21T13:52:43.602Z","etag":null,"topics":["pytorch","ssd","ssd-pytorch","ssd-tutorial","ssd-vgg16"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ChunML.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"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":"2019-06-03T05:55:21.000Z","updated_at":"2021-12-15T20:11:05.000Z","dependencies_parsed_at":"2023-06-04T00:30:14.355Z","dependency_job_id":null,"html_url":"https://github.com/ChunML/ssd-pytorch","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ChunML%2Fssd-pytorch","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ChunML%2Fssd-pytorch/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ChunML%2Fssd-pytorch/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ChunML%2Fssd-pytorch/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ChunML","download_url":"https://codeload.github.com/ChunML/ssd-pytorch/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245626155,"owners_count":20646309,"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":["pytorch","ssd","ssd-pytorch","ssd-tutorial","ssd-vgg16"],"created_at":"2024-10-07T13:40:27.686Z","updated_at":"2025-03-26T09:32:23.228Z","avatar_url":"https://github.com/ChunML.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# SSD - Implementation in Pytorch\n\n### Requirements\n- Python 3.X\n- Pytorch \u003e1.0.0\n- OpenCV\n- numpy\n- matplotlib\n- CUDA (tested on CUDA 9, CUDA 10)\n- cuDNN\n\n### Generate pretrained weights for VGG16\n```\npython create_vgg16_weights.py\n```\n\n### Training\n```\npython train.py --help\nusage: train.py [-h] [--data_dir DATA_DIR] [--augmentation AUGMENTATION]\n                [--pretrained_path PRETRAINED_PATH] [--neg_ratio NEG_RATIO]\n                [--lr LR] [--momentum MOMENTUM] [--weight_decay WEIGHT_DECAY]\n                [--gamma GAMMA] [--arch ARCH] [--num_examples NUM_EXAMPLES]\n                [--batch_size BATCH_SIZE] [--num_epochs NUM_EPOCHS]\n                [--checkpoint_dir CHECKPOINT_DIR]\n\noptional arguments:\n  -h, --help            show this help message and exit\n  --data_dir DATA_DIR   data root directory\n  --augmentation AUGMENTATION\n                        whether to perform augmentation of data\n  --pretrained_path PRETRAINED_PATH\n                        pretrained weight path\n  --neg_ratio NEG_RATIO\n                        negative examples ratio (used in hard negative mining\n                        logic)\n  --lr LR               initial learning rate\n  --momentum MOMENTUM   momentum (used in SGD)\n  --weight_decay WEIGHT_DECAY\n                        weight decay (used in SGD)\n  --gamma GAMMA         gamma (used in SGD)\n  --arch ARCH           SSD architecture, can be either ssd300 or ssd512\n  --num_examples NUM_EXAMPLES\n                        number of examples to train\n  --batch_size BATCH_SIZE\n                        batch size\n  --num_epochs NUM_EPOCHS\n                        number of epochs to train\n  --checkpoint_dir CHECKPOINT_DIR\n                        directory to store training weights\n```\n\nExample 1: train SSD300 on 40 examples, batch_size=10 without augmentation using the pretrained weights generated above\n```\npython train.py --num_examples 40 --batch_size 10 --pretrained_path ./weights/new_vgg.pth --augmentation False\n```\n\nExample 2: train SSD512 on full dataset, batch_size=32 using the pretrained weights generated above on 120 epochs\n```\npython train.py --pretrained_path ./weights/new_vgg.pth --arch ssd512 --num_epochs 120\n```\n\n### Test\n```\npython test.py --help\nusage: test.py [-h] [--data_dir DATA_DIR] [--arch ARCH]\n               [--save_image_dir SAVE_IMAGE_DIR]\n               [--pretrained_path PRETRAINED_PATH]\n               [--num_examples NUM_EXAMPLES]\n               [--max_num_boxes_per_class MAX_NUM_BOXES_PER_CLASS]\n               [--score_thresh SCORE_THRESH] [--nms_thresh NMS_THRESH]\n               [--batch_size BATCH_SIZE]\n\noptional arguments:\n  -h, --help            show this help message and exit\n  --data_dir DATA_DIR   data root directory\n  --arch ARCH           SSD architecture, can be either ssd300 or ssd512\n  --save_image_dir SAVE_IMAGE_DIR\n                        directory to save result images\n  --pretrained_path PRETRAINED_PATH\n                        pretrained weight path\n  --num_examples NUM_EXAMPLES\n                        number of examples to test\n  --max_num_boxes_per_class MAX_NUM_BOXES_PER_CLASS\n                        maximum number of objects per class (used in NMS\n                        logic)\n  --score_thresh SCORE_THRESH\n                        score threshold\n  --nms_thresh NMS_THRESH\n                        NMS threshold\n  --batch_size BATCH_SIZE\n                        batch size\n```\n\nExample: test the SSD512 trained by the command above on full dataset\n```\npython test.py --pretrained_path ./models/ssd_epoch_120.pth --arch ssd512 --num_examples -1\n```\n\n### TODOs\n- [ ] Random patching\n- [ ] Random distortion\n- [ ] VOC Evaluation\n- [ ] OpenCV -\u003e PIL for better font setting\n\n### Paper\n**SSD: Single Shot MultiBox Detector**\n\n[[Paper]](https://arxiv.org/abs/1512.02325) [[Code]](https://github.com/weiliu89/caffe/tree/ssd)\n\n### Reference\n- [amdegroot's implementation](https://github.com/amdegroot/ssd.pytorch)\n- [qfgaohao's implementation](https://github.com/qfgaohao/pytorch-ssd)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fchunml%2Fssd-pytorch","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fchunml%2Fssd-pytorch","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fchunml%2Fssd-pytorch/lists"}