{"id":16199691,"url":"https://github.com/zhiyiyo/ssd","last_synced_at":"2026-02-25T05:33:04.361Z","repository":{"id":112585324,"uuid":"426299326","full_name":"zhiyiYo/SSD","owner":"zhiyiYo","description":"A minimum implementation of SSD object detection using pytorch.","archived":false,"fork":false,"pushed_at":"2022-03-01T10:30:32.000Z","size":14511,"stargazers_count":15,"open_issues_count":0,"forks_count":6,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-04-02T23:41:36.423Z","etag":null,"topics":["object-detection","pytorch","ssd"],"latest_commit_sha":null,"homepage":"https://www.cnblogs.com/zhiyiYo/p/15568875.html","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/zhiyiYo.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":"2021-11-09T16:14:53.000Z","updated_at":"2025-01-04T16:28:19.000Z","dependencies_parsed_at":"2023-05-16T18:00:40.963Z","dependency_job_id":null,"html_url":"https://github.com/zhiyiYo/SSD","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"purl":"pkg:github/zhiyiYo/SSD","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zhiyiYo%2FSSD","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zhiyiYo%2FSSD/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zhiyiYo%2FSSD/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zhiyiYo%2FSSD/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/zhiyiYo","download_url":"https://codeload.github.com/zhiyiYo/SSD/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zhiyiYo%2FSSD/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":281038749,"owners_count":26433646,"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","status":"online","status_checked_at":"2025-10-25T02:00:06.499Z","response_time":81,"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":["object-detection","pytorch","ssd"],"created_at":"2024-10-10T09:27:13.186Z","updated_at":"2025-10-25T23:46:40.725Z","avatar_url":"https://github.com/zhiyiYo.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# SSD\nAn minimum implementation of SSD object detection using pytorch.\n\n## Prepare environment\n1. Create virtual environment:\n\n    ```shell\n    conda create -n SSD python=3.8\n    conda activate SSD\n    pip install -r requirements.txt\n    ```\n\n2. Install [pytorch](https://pytorch.org/), refer to the [blog](https://www.cnblogs.com/zhiyiYo/p/15865454.html) for details.\n\n\n## Train\n1. Download VOC2007 dataset from following website and unzip them:\n   * http://host.robots.ox.ac.uk/pascal/VOC/voc2007/VOCtrainval_06-Nov-2007.tar\n   * http://host.robots.ox.ac.uk/pascal/VOC/voc2007/VOCtest_06-Nov-2007.tar\n\n2. Download pre-trained and fc-reduced `VGG16` model from [here](https://github.com/zhiyiYo/SSD/releases/download/v1.0.0/vgg16_reducedfc.pth).\n\n3. Modify the value of `root` in `train.py`, please ensure that the directory structure of the `root` folder is as follows:\n\n    ```txt\n    root\n    ├───Annotations\n    ├───ImageSets\n    │   ├───Layout\n    │   ├───Main\n    │   └───Segmentation\n    ├───JPEGImages\n    ├───SegmentationClass\n    └───SegmentationObject\n    ```\n\n4. Start training:\n\n    ```shell\n    conda activate SSD\n    python train.py\n    ```\n\n## Loss Curve\nWhen `lr` is 5e-4, `batch_ size` is 8 and train on VOC2007 + VOC2012, the training loss curve is shown in following figure:\n\n![损失曲线](resource/image/损失曲线.png)\n\n## Evaluation\n### one model\n1. Modify the value of `root` and `model_path` in `eval.py`.\n2. Calculate mAP:\n\n    ```sh\n    conda activate SSD\n    python eval.py\n    ```\n\n### multi models\n1. Modify the value of `root` and `model_dir` in `evals.py`.\n2. Calculate and plot mAP:\n\n    ```shell\n    conda activate SSD\n    python evals.py\n    ```\n\n### mAP curve\n![mAP 曲线](resource/image/mAP曲线.png)\n\n\n### best mAP\n| class       | AP     |\n| ----------- | ------ |\n| aeroplane   | 74.15% |\n| bicycle     | 83.26% |\n| bird        | 70.90% |\n| boat        | 64.99% |\n| bottle      | 42.33% |\n| bus         | 85.87% |\n| car         | 84.64% |\n| cat         | 89.25% |\n| chair       | 56.23% |\n| cow         | 79.70% |\n| diningtable | 72.67% |\n| dog         | 85.87% |\n| horse       | 88.80% |\n| motorbike   | 84.49% |\n| person      | 78.48% |\n| pottedplant | 42.97% |\n| sheep       | 76.03% |\n| sofa        | 77.72% |\n| train       | 86.43% |\n| tvmonitor   | 75.85% |\n| mAP         | 75.03% |\n\n## Detection\n1. Download `SSD_120000.pth` from [here](https://github.com/zhiyiYo/SSD/releases/download/v1.1.0/SSD_120000.pth).\n2. Modify the value of `model_path` and `image_path` in `demo.py`.\n3. Display detection results:\n\n    ```shell\n    conda activate SSD\n    python demo.py\n    ```\n\n\n## Notes\n1. Sometimes `loss` may become `nan`. If this happens, please reduce the value of `lr`.\n2. 75.03% mAP may not be the limit of this project. This is the result of 7.5 hours of training on NVIDIA RTX 3090. You can try to increase the `batch_size` and `lr`, and then iterate 120000 times on the VOC2007 + VOC2012. The mAP should be higher. If you get a better result, please don't hesitate to tell me.\n3. If you want to train custom dataset, here are some steps to follow:\n   1. The label file must be in the same XML format as VOC2007, and the structure of dataset must be the same as follows:\n\n        ```txt\n        root\n        ├───Annotations\n        ├───ImageSets\n        │   └───Main\n        └───JPEGImages\n        ```\n   2. Put your `test.txt` and `train.txt` in the `Main` folder. These txt files must contain the names of the corresponding **jpg** format pictures. These names do not need a suffix.\n   3. Modify the `classes` property of `VOCDataset` in `net/dataset.py` to include all the classes in your dataset.\n   4. Change the `root` and `image_set` of `VOCDataset` in `train.py` and start training.\n\n\n## Reference\n* [[Paper] SSD: Single Shot MultiBox Detector](https://arxiv.org/abs/1512.02325)\n* [[GitHub] amdegroot / ssd.pytorch](https://github.com/amdegroot/ssd.pytorch)\n\n\n## License\n```txt\nMIT License\n\nCopyright (c) 2021 Huang Zhengzhi\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all\ncopies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\nSOFTWARE.\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzhiyiyo%2Fssd","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fzhiyiyo%2Fssd","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzhiyiyo%2Fssd/lists"}