{"id":22039908,"url":"https://github.com/dog-qiuqiu/fastestdet","last_synced_at":"2025-04-04T06:08:37.680Z","repository":{"id":41276922,"uuid":"508635170","full_name":"dog-qiuqiu/FastestDet","owner":"dog-qiuqiu","description":":zap: A newly designed ultra lightweight anchor free target detection algorithm， weight only 250K parameters， reduces the time consumption by 10% compared with yolo-fastest, and the post-processing is simpler","archived":false,"fork":false,"pushed_at":"2023-03-16T15:19:16.000Z","size":25534,"stargazers_count":756,"open_issues_count":30,"forks_count":131,"subscribers_count":12,"default_branch":"main","last_synced_at":"2024-07-31T21:53:46.449Z","etag":null,"topics":["computer-vision","deep-learning","object-detection"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"bsd-3-clause","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/dog-qiuqiu.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.md","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":"2022-06-29T09:55:30.000Z","updated_at":"2024-07-31T11:39:51.000Z","dependencies_parsed_at":"2024-01-13T17:13:33.048Z","dependency_job_id":"5bcc646b-85ae-45c9-88b7-1c6598f29261","html_url":"https://github.com/dog-qiuqiu/FastestDet","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dog-qiuqiu%2FFastestDet","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dog-qiuqiu%2FFastestDet/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dog-qiuqiu%2FFastestDet/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dog-qiuqiu%2FFastestDet/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/dog-qiuqiu","download_url":"https://codeload.github.com/dog-qiuqiu/FastestDet/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247128751,"owners_count":20888235,"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","object-detection"],"created_at":"2024-11-30T11:12:48.307Z","updated_at":"2025-04-04T06:08:37.650Z","avatar_url":"https://github.com/dog-qiuqiu.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"***2022.7.14:Optimize loss, adopt IOU aware based on smooth L1, and the AP is significantly increased by 0.7***\n# :zap:FastestDet:zap:\n[![DOI](https://zenodo.org/badge/508635170.svg)](https://zenodo.org/badge/latestdoi/508635170)\n![image](https://img.shields.io/github/license/dog-qiuqiu/FastestDet)\n![image](https://img.shields.io/github/stars/dog-qiuqiu/FastestDet?style=flat)\n![image](https://github.com/dog-qiuqiu/FastestDet/blob/main/data/data.png)\n* ***Faster! Stronger! Simpler!***\n* ***It has better performance and simpler feature map post-processing than Yolo-fastest***\n* ***The performance is 10% higher than Yolo-fastest***\n* ***The coco evaluation index increased by 1.2% compared with the map0.5 of Yolo-fastestv2***\n* ***算法介绍：https://zhuanlan.zhihu.com/p/536500269 交流qq群:1062122604***\n# Evaluating indicator/Benchmark\nNetwork|mAPval 0.5|mAPval 0.5:0.95|Resolution|Run Time(4xCore)|Run Time(1xCore)|Params(M)\n:---:|:---:|:---:|:---:|:---:|:---:|:---:\n[yolov5s](https://github.com/ultralytics/yolov5)|56.8%|37.4%|640X640|395.31ms|1139.16ms|7.2M\n[yolov6n](https://github.com/meituan/YOLOv6)|-|30.8%|416X416|109.24ms|445.44ms|4.3M\n[yolox-nano](https://github.com/Megvii-BaseDetection/YOLOX)|-|25.8%|416X416|76.31ms|191.16ms|0.91M\n[nanodet_m](https://github.com/RangiLyu/nanodet)|-|20.6%|320X320|49.24ms|160.35ms|0.95M\n[yolo-fastestv1.1](https://github.com/dog-qiuqiu/Yolo-Fastest/tree/master/ModelZoo/yolo-fastest-1.1_coco)|24.40%|-|320X320|26.60ms|75.74ms|0.35M\n[yolo-fastestv2](https://github.com/dog-qiuqiu/Yolo-FastestV2/tree/main/modelzoo)|24.10%|-|352X352|23.8ms|68.9ms|0.25M\nFastestDet|25.3%|13.0%|352X352|23.51ms|70.62ms|0.24M\n* ***Test platform Radxa Rock3A RK3568 ARM Cortex-A55 CPU，Based on [NCNN](https://github.com/Tencent/ncnn)***\n* ***CPU lock frequency 2.0GHz***\n# Improvement\n* Anchor-Free\n* Single scale detector head\n* Cross grid multiple candidate targets\n* Dynamic positive and negative sample allocation\n# Multi-platform benchmark\nEquipment|Computing backend|System|Framework|Run time(Single core)|Run time(Multi core)\n:---:|:---:|:---:|:---:|:---:|:---:\nRadxa rock3a|RK3568(arm-cpu)|Linux(aarch64)|ncnn|70.62ms|23.51ms\nRadxa rock3a|RK3568(NPU)|Linux(aarch64)|rknn|28ms|-\nQualcomm|Snapdragon 835(arm-cpu)|Android(aarch64)|ncnn|32.34ms|16.24ms\nIntel|i7-8700(X86-cpu)|Linux(amd64)|ncnn|4.51ms|4.33ms\n# How to use\n## Dependent installation\n* PiP(Note pytorch CUDA version selection)\n  ```\n  pip install -r requirements.txt\n  ```\n## Test\n* Picture test\n  ```\n  python3 test.py --yaml configs/coco.yaml --weight weights/weight_AP05:0.253207_280-epoch.pth --img data/3.jpg\n  ```\n\u003cdiv align=center\u003e\n\u003cimg src=\"https://github.com/dog-qiuqiu/FastestDet/blob/main/result.png\"\u003e /\u003e\n\u003c/div\u003e\n\n## How to train\n### Building data sets(The dataset is constructed in the same way as darknet yolo)\n* The format of the data set is the same as that of Darknet Yolo, Each image corresponds to a .txt label file. The label format is also based on Darknet Yolo's data set label format: \"category cx cy wh\", where category is the category subscript, cx, cy are the coordinates of the center point of the normalized label box, and w, h are the normalized label box The width and height, .txt label file content example as follows:\n  ```\n  11 0.344192634561 0.611 0.416430594901 0.262\n  14 0.509915014164 0.51 0.974504249292 0.972\n  ```\n* The image and its corresponding label file have the same name and are stored in the same directory. The data file structure is as follows:\n  ```\n  .\n  ├── train\n  │   ├── 000001.jpg\n  │   ├── 000001.txt\n  │   ├── 000002.jpg\n  │   ├── 000002.txt\n  │   ├── 000003.jpg\n  │   └── 000003.txt\n  └── val\n      ├── 000043.jpg\n      ├── 000043.txt\n      ├── 000057.jpg\n      ├── 000057.txt\n      ├── 000070.jpg\n      └── 000070.txt\n  ```\n* Generate a dataset path .txt file, the example content is as follows：\n  \n  train.txt\n  ```\n  /home/qiuqiu/Desktop/dataset/train/000001.jpg\n  /home/qiuqiu/Desktop/dataset/train/000002.jpg\n  /home/qiuqiu/Desktop/dataset/train/000003.jpg\n  ```\n  val.txt\n  ```\n  /home/qiuqiu/Desktop/dataset/val/000070.jpg\n  /home/qiuqiu/Desktop/dataset/val/000043.jpg\n  /home/qiuqiu/Desktop/dataset/val/000057.jpg\n  ```\n* Generate the .names category label file, the sample content is as follows:\n \n  category.names\n  ```\n  person\n  bicycle\n  car\n  motorbike\n  ...\n  \n  ```\n* The directory structure of the finally constructed training data set is as follows:\n  ```\n  .\n  ├── category.names        # .names category label file\n  ├── train                 # train dataset\n  │   ├── 000001.jpg\n  │   ├── 000001.txt\n  │   ├── 000002.jpg\n  │   ├── 000002.txt\n  │   ├── 000003.jpg\n  │   └── 000003.txt\n  ├── train.txt              # train dataset path .txt file\n  ├── val                    # val dataset\n  │   ├── 000043.jpg\n  │   ├── 000043.txt\n  │   ├── 000057.jpg\n  │   ├── 000057.txt\n  │   ├── 000070.jpg\n  │   └── 000070.txt\n  └── val.txt                # val dataset path .txt file\n\n  ```\n### Build the training .yaml configuration file\n* Reference./configs/coco.yaml\n  ```\n  DATASET:\n    TRAIN: \"/home/qiuqiu/Desktop/coco2017/train2017.txt\"  # Train dataset path .txt file\n    VAL: \"/home/qiuqiu/Desktop/coco2017/val2017.txt\"      # Val dataset path .txt file \n    NAMES: \"dataset/coco128/coco.names\"                   # .names category label file\n  MODEL:\n    NC: 80                                                # Number of detection categories\n    INPUT_WIDTH: 352                                      # The width of the model input image\n    INPUT_HEIGHT: 352                                     # The height of the model input image\n  TRAIN:\n    LR: 0.001                                             # Train learn rate\n    THRESH: 0.25                                          # ？？？？\n    WARMUP: true                                          # Trun on warm up\n    BATCH_SIZE: 64                                        # Batch size\n    END_EPOCH: 350                                        # Train epichs\n    MILESTIONES:                                          # Declining learning rate steps\n      - 150\n      - 250\n      - 300\n  ```\n### Train\n* Perform training tasks\n  ```\n  python3 train.py --yaml configs/coco.yaml\n  ```\n### Evaluation\n* Calculate map evaluation\n  ```\n  python3 eval.py --yaml configs/coco.yaml --weight weights/weight_AP05:0.253207_280-epoch.pth\n  ```\n* COCO2017 evaluation\n  ```\n  creating index...\n  index created!\n  creating index...\n  index created!\n  Running per image evaluation...\n  Evaluate annotation type *bbox*\n  DONE (t=30.85s).\n  Accumulating evaluation results...\n  DONE (t=4.97s).\n  Average Precision  (AP) @[ IoU=0.50:0.95 | area=   all | maxDets=100 ] = 0.130\n  Average Precision  (AP) @[ IoU=0.50      | area=   all | maxDets=100 ] = 0.253\n  Average Precision  (AP) @[ IoU=0.75      | area=   all | maxDets=100 ] = 0.119\n  Average Precision  (AP) @[ IoU=0.50:0.95 | area= small | maxDets=100 ] = 0.021\n  Average Precision  (AP) @[ IoU=0.50:0.95 | area=medium | maxDets=100 ] = 0.129\n  Average Precision  (AP) @[ IoU=0.50:0.95 | area= large | maxDets=100 ] = 0.237\n  Average Recall     (AR) @[ IoU=0.50:0.95 | area=   all | maxDets=  1 ] = 0.142\n  Average Recall     (AR) @[ IoU=0.50:0.95 | area=   all | maxDets= 10 ] = 0.208\n  Average Recall     (AR) @[ IoU=0.50:0.95 | area=   all | maxDets=100 ] = 0.214\n  Average Recall     (AR) @[ IoU=0.50:0.95 | area= small | maxDets=100 ] = 0.043\n  Average Recall     (AR) @[ IoU=0.50:0.95 | area=medium | maxDets=100 ] = 0.236\n  Average Recall     (AR) @[ IoU=0.50:0.95 | area= large | maxDets=100 ] = 0.372\n\n  ```\n# Deploy\n## Export onnx\n* You can export .onnx by adding the --onnx option when executing test.py\n  ```\n  python3 test.py --yaml configs/coco.yaml --weight weights/weight_AP05:0.253207_280-epoch.pth --img data/3.jpg --onnx\n  ```\n## Export torchscript\n* You can export .pt by adding the --torchscript option when executing test.py\n  ```\n  python3 test.py --yaml configs/coco.yaml --weight weights/weight_AP05:0.253207_280-epoch.pth --img data/3.jpg --torchscript\n  ```\n## NCNN\n* Need to compile ncnn and opencv in advance and modify the path in build.sh\n  ```\n  cd example/ncnn/\n  sh build.sh\n  ./FastestDet\n  ```\n## onnx-runtime\n* You can learn about the pre and post-processing methods of FastestDet in this Sample\n  ```\n  cd example/onnx-runtime\n  pip install onnx-runtime\n  python3 runtime.py\n  ```\n# Citation\n* If you find this project useful in your research, please consider cite:\n  ```\n  @misc{=FastestDet,\n        title={FastestDet: Ultra lightweight anchor-free real-time object detection algorithm.},\n        author={xuehao.ma},\n        howpublished = {\\url{https://github.com/dog-qiuqiu/FastestDet}},\n        year={2022}\n  }\n  ```\n# Reference\n* https://github.com/Tencent/ncnn\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdog-qiuqiu%2Ffastestdet","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdog-qiuqiu%2Ffastestdet","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdog-qiuqiu%2Ffastestdet/lists"}