一个目标检测的通用框架(不需要cuda编译),支持Yolo全系列(v2~v5)、EfficientDet、RetinaNet、Cascade-RCNN等SOTA网络。

Overview

detection_template

  一个目标检测的通用框架(不需要cuda编译),支持Yolo全系列(v2~v5)、EfficientDet、RetinaNet、Cascade-RCNN等SOTA网络,Kaggle小麦检测12/2245。

preview

Functionalities

  • 数据格式

    • VOC
    • COCO
    • 自定义格式
  • 网络模型

    • EfficientDet(目前不支持训练过程中验证)
    • YoloV2、V3
    • YoloV4
    • YoloV5
    • SSD300、SSD512
    • Faster-RCNN
    • Cascade-RCNN
    • RetinaNet
  • TTA

    • 多尺度融合
    • nms
    • Weighted Box Fusion(WBF)
    • 伪标签
  • Scheduler

    • Step Scheduler
    • 验证集指标不下降时学习率衰减
  • Metrics

    • mAP
  • 可视化

    • 数据集bbox预览
    • dataloader数据增强预览
    • 预测结果预览
  • 辅助工具

    • 手工标注工具

安装和使用教程

安装和使用教程见 get_started.md.

预训练模型

Model backbone 数据集 论文[email protected] 复现[email protected] 下载链接 密码 sha256
YoloV2 Darknet-19 VOC 76.8 76.46 [百度网盘] mwik 5d29a34b
YoloV3 Darknet-19 COCO 55.3 - [百度网盘] cf4j 943b926a
FRCNN Res50+FPN VOC - 83.26 [百度网盘] isqt 3d5c3b15
FRCNN Res50+FPN COCO 48.81 [pytorch] - 258fb6c6
YoloV4 CSPDarknet-53 COCO 62.8 - [百度网盘] nio7 797dc954
YoloV5 CSPDarknet COCO - 64.30 [百度网盘] cssw 8e54a2e8
SSD300 VGG16 VOC 77.2 79.21 [百度网盘] 59y0 106c0fc9
SSD512 VGG16 VOC 79.8 82.14 [百度网盘] 0iur 844b40b3

Reference

Comments
  • 在自己数据集下运行preview.py报错 ValueError: Expected y_max for bbox

    在自己数据集下运行preview.py报错 ValueError: Expected y_max for bbox

    信息如下: Traceback (most recent call last):24493 .........] ETA: 41m File "preview.py", line 33, in for i, sample in enumerate(preview): File "/opt/conda/lib/python3.7/site-packages/torch/utils/data/dataloader.py", line 345, in next data = self._next_data() File "/opt/conda/lib/python3.7/site-packages/torch/utils/data/dataloader.py", line 385, in _next_data data = self._dataset_fetcher.fetch(index) # may raise StopIteration File "/opt/conda/lib/python3.7/site-packages/torch/utils/data/_utils/fetch.py", line 44, in fetch data = [self.dataset[idx] for idx in possibly_batched_index] File "/opt/conda/lib/python3.7/site-packages/torch/utils/data/_utils/fetch.py", line 44, in data = [self.dataset[idx] for idx in possibly_batched_index] File "/home/lungchi/easy_detection/dataloader/list_dataset.py", line 21, in getitem return dataset[index - total] File "/home/lungchi/easy_detection/dataloader/voc.py", line 213, in getitem 'labels': labels File "/opt/conda/lib/python3.7/site-packages/albumentations/core/composition.py", line 188, in call p.preprocess(data) File "/opt/conda/lib/python3.7/site-packages/albumentations/core/utils.py", line 84, in preprocess data[data_name] = self.check_and_convert(data[data_name], rows, cols, direction="to") File "/opt/conda/lib/python3.7/site-packages/albumentations/core/utils.py", line 92, in check_and_convert return self.convert_to_albumentations(data, rows, cols) File "/opt/conda/lib/python3.7/site-packages/albumentations/augmentations/bbox_utils.py", line 51, in convert_to_albumentations return convert_bboxes_to_albumentations(data, self.params.format, rows, cols, check_validity=True) File "/opt/conda/lib/python3.7/site-packages/albumentations/augmentations/bbox_utils.py", line 306, in convert_bboxes_to_albumentations return [convert_bbox_to_albumentations(bbox, source_format, rows, cols, check_validity) for bbox in bboxes] File "/opt/conda/lib/python3.7/site-packages/albumentations/augmentations/bbox_utils.py", line 306, in return [convert_bbox_to_albumentations(bbox, source_format, rows, cols, check_validity) for bbox in bboxes] File "/opt/conda/lib/python3.7/site-packages/albumentations/augmentations/bbox_utils.py", line 254, in convert_bbox_to_albumentations check_bbox(bbox) File "/opt/conda/lib/python3.7/site-packages/albumentations/augmentations/bbox_utils.py", line 333, in check_bbox "to be in the range [0.0, 1.0], got {value}.".format(bbox=bbox, name=name, value=value) ValueError: Expected y_max for bbox (0.19440914866581957, 0.14192139737991266, 0.7903430749682337, 1.0087336244541485, 1) to be in the range [0.0, 1.0], got 1.0087336244541485.

    opened by TIMEXue 2
  • onvert to onnx fail

    onvert to onnx fail

    Use Yolo2, train VOC ok, eval ok, but when I try to convert to onnx model, failed~

    convert by

    input_shape = (3, 224, 224)
    torch.randn(1, input_shape[0], input_shape[1], input_shape[2], dtype=torch.float32, requires_grad=False).to(device)
    torch.onnx.export(model, input, "out/model.onnx", export_params=True, input_names = ["input0"], output_names=["output0"])
    

    error:

      File "/home/neucrack/project/others/detection_template/utils/convert.py", line 15, in torch_to_onnx
        torch.onnx.export(net, x, out_name, export_params=True, input_names = input_names, output_names=output_names)
      File "/home/neucrack/miniconda3/lib/python3.8/site-packages/torch/onnx/__init__.py", line 225, in export
        return utils.export(model, args, f, export_params, verbose, training,
      File "/home/neucrack/miniconda3/lib/python3.8/site-packages/torch/onnx/utils.py", line 85, in export
        _export(model, args, f, export_params, verbose, training, input_names, output_names,
      File "/home/neucrack/miniconda3/lib/python3.8/site-packages/torch/onnx/utils.py", line 632, in _export
        _model_to_graph(model, args, verbose, input_names,
      File "/home/neucrack/miniconda3/lib/python3.8/site-packages/torch/onnx/utils.py", line 409, in _model_to_graph
        graph, params, torch_out = _create_jit_graph(model, args,
      File "/home/neucrack/miniconda3/lib/python3.8/site-packages/torch/onnx/utils.py", line 379, in _create_jit_graph
        graph, torch_out = _trace_and_get_graph_from_model(model, args)
      File "/home/neucrack/miniconda3/lib/python3.8/site-packages/torch/onnx/utils.py", line 342, in _trace_and_get_graph_from_model
        torch.jit._get_trace_graph(model, args, strict=False, _force_outplace=False, _return_inputs_states=True)
      File "/home/neucrack/miniconda3/lib/python3.8/site-packages/torch/jit/_trace.py", line 1149, in _get_trace_graph
        outs = ONNXTracedModule(f, strict, _force_outplace, return_inputs, _return_inputs_states)(*args, **kwargs)
      File "/home/neucrack/miniconda3/lib/python3.8/site-packages/torch/nn/modules/module.py", line 727, in _call_impl
        result = self.forward(*input, **kwargs)
      File "/home/neucrack/miniconda3/lib/python3.8/site-packages/torch/jit/_trace.py", line 126, in forward
        graph, out = torch._C._create_graph_by_tracing(
      File "/home/neucrack/miniconda3/lib/python3.8/site-packages/torch/jit/_trace.py", line 120, in wrapper
        out_vars, _ = _flatten(outs)
    RuntimeError: Only tuples, lists and Variables supported as JIT inputs/outputs. Dictionaries and strings are also accepted but their usage is not recommended. But got unsupported type numpy.ndarray
    
    opened by Neutree 2
  • 关于预测可视化的问题

    关于预测可视化的问题

    get_started.md中原话: “4. 如果需要使用Tensorboard可视化预测结果,可以在上面的命令最后加上--vis参数。然后运行tensorboard --logdir results/cache查看检测的可视化结果”, 但是查看了代码发现,并没有预测结果可视化功能,请问是还没更新吗

    opened by TIMEXue 1
  • 按您的步骤来,请问这个问题该怎么解决

    按您的步骤来,请问这个问题该怎么解决

    按您的步骤来,在运行单卡训练程序python3 train.py --config configs/faster_rcnn_voc.yml时遇到报错 :TypeError: resnet50() missing 1 required positional argument: 'epoch' 请问如何解决这个报错

    具体如下: Use dataset: datasets/voc, split: train Load Anno... Step: [=========== 16551/16551 =====>] ETA: 0s 57m
    aeroplane: 1171 (2.92%) bicycle: 1064 (2.66%) bird: 1605 (4.01%) boat: 1140 (2.85%) bottle: 1764 (4.40%) bus: 822 (2.05%) car: 3267 (8.16%) cat: 1593 (3.98%) chair: 3152 (7.87%) cow: 847 (2.11%) diningtable: 824 (2.06%) dog: 2025 (5.06%) horse: 1072 (2.68%) motorbike: 1052 (2.63%) person: 13256 (33.09%) pottedplant: 1487 (3.71%) sheep: 1070 (2.67%) sofa: 814 (2.03%) train: 925 (2.31%) tvmonitor: 1108 (2.77%) Total bboxes: 40058 7165 difficult bboxes ignored. Use dataset: datasets/voc, split: test Load Anno... Step: [=========== 4952/4952 =======>] ETA: 0s 30m
    aeroplane: 285 (2.37%) bicycle: 337 (2.80%) bird: 459 (3.81%) boat: 263 (2.19%) bottle: 469 (3.90%) bus: 213 (1.77%) car: 1201 (9.98%) cat: 358 (2.98%) chair: 756 (6.28%) cow: 244 (2.03%) diningtable: 206 (1.71%) dog: 489 (4.06%) horse: 348 (2.89%) motorbike: 325 (2.70%) person: 4528 (37.63%) pottedplant: 480 (3.99%) sheep: 242 (2.01%) sofa: 239 (1.99%) train: 282 (2.34%) tvmonitor: 308 (2.56%) Total bboxes: 12032 2944 difficult bboxes ignored. [INFO] 2022-10-01 14:51:59 ==================Configs================== [INFO] 2022-10-01 14:51:59 MODEL: [INFO] 2022-10-01 14:51:59 NAME: Faster_RCNN [INFO] 2022-10-01 14:51:59 BACKBONE: resnet50 [INFO] 2022-10-01 14:51:59
    [INFO] 2022-10-01 14:51:59 DATA: [INFO] 2022-10-01 14:51:59 DATASET: voc [INFO] 2022-10-01 14:51:59 TRANSFORM: frcnn [INFO] 2022-10-01 14:51:59 SCALE: [800, 1333] [INFO] 2022-10-01 14:51:59 OPTIMIZE: [INFO] 2022-10-01 14:51:59 OPTIMIZER: sgd [INFO] 2022-10-01 14:51:59 BASE_LR: 0.001 [INFO] 2022-10-01 14:51:59 SCHEDULER: 1x [INFO] 2022-10-01 14:51:59 BATCH_SIZE: 2 [INFO] 2022-10-01 14:51:59 TEST: [INFO] 2022-10-01 14:51:59 NMS_THRESH : 0.5
    [INFO] 2022-10-01 14:51:59 CONF_THRESH: 0.05 [INFO] 2022-10-01 14:51:59 MISC: [INFO] 2022-10-01 14:51:59 VAL_FREQ: 1 [INFO] 2022-10-01 14:51:59 SAVE_FREQ: 1 [INFO] 2022-10-01 14:51:59 NUM_WORKERS: 0 [INFO] 2022-10-01 14:51:59 ==================Options================== [INFO] 2022-10-01 14:51:59 config=configs/faster_rcnn_voc.yml [INFO] 2022-10-01 14:51:59 debug=False [INFO] 2022-10-01 14:51:59 device=cuda:0 [INFO] 2022-10-01 14:51:59 epochs=500 [INFO] 2022-10-01 14:51:59 gpu_id=0 [INFO] 2022-10-01 14:51:59 load=None [INFO] 2022-10-01 14:51:59 local_rank=None [INFO] 2022-10-01 14:51:59 no_val=False [INFO] 2022-10-01 14:51:59 resume=False [INFO] 2022-10-01 14:51:59 save_path=None [INFO] 2022-10-01 14:51:59 tag=faster_rcnn_voc [INFO] 2022-10-01 14:51:59 vis=False [INFO] 2022-10-01 14:51:59 =========================================== Traceback (most recent call last): File "train.py", line 65, in model = Model(config) File "/media/omnisky/c387317d-6f40-4cef-9f5b-e9477942c7c61/fattyhu/catkin_ws/src/easy_detection-master/network/Faster_RCNN/Model.py", line 61, in init self.detector = fasterrcnn_resnet50_fpn(pretrained=False, **kargs) File "/media/omnisky/c387317d-6f40-4cef-9f5b-e9477942c7c61/fattyhu/catkin_ws/src/easy_detection-master/network/Faster_RCNN/frcnn/faster_rcnn.py", line 335, in fasterrcnn_resnet50_fpn backbone = resnet_fpn_backbone('resnet50', pretrained_backbone, norm_layer=norm_layer) File "/media/omnisky/c387317d-6f40-4cef-9f5b-e9477942c7c61/fattyhu/catkin_ws/src/easy_detection-master/network/Faster_RCNN/frcnn/backbone_utils.py", line 47, in resnet_fpn_backbone norm_layer=torch.nn.SyncBatchNorm) TypeError: resnet50() missing 1 required positional argument: 'epoch'

    opened by captaincola 0
  • 运行train.py时候出现UserWarning

    运行train.py时候出现UserWarning

    运行指令时候python3 train.py --config configs/faster_rcnn_voc.yml,出现了如下警告: .\easy_detection-master\network\SSD\utils\nms.py:15: UserWarning: No NMS is available. Please upgrade torchvision to 0.3.0+ or compile c++ NMS using cd ext & python build.py build_ext develop warnings.warn('No NMS is available. Please upgrade torchvision to 0.3.0+ or compile c++ NMS ' 求大神解答!

    opened by YipChakwai 1
  • 请问inference.py应该怎么运行起来呢?麻烦解答,谢谢了!

    请问inference.py应该怎么运行起来呢?麻烦解答,谢谢了!

    运行命令为:python3 inference.py --config configs/faster_rcnn_voc.yml 代码中的LOAD_CHECKPOINT、INFERENCE_LIST、IMAGE_FOLDER均改为自己的数据集和权重。 错误为:File "/home/easy_detection-master/network/Faster_RCNN/Model.py", line 40, in init if 'SCALE' in config.DATA: AttributeError: 'Option' object has no attribute 'DATA'

    感谢!

    opened by Beeeee-cyber 1
  • 'Namespace' object has no attribute 'width'

    'Namespace' object has no attribute 'width'

    when training with yolov3, I met the problem that 'Namespace' object has no attribute 'width', while it has no problem when training with yolov2. The code is shape = (opt.width, opt.height) How should I verify the code to make it run successfully! Thanks!

    opened by Man3350 1
Owner
Haoyu Xu
Tecent intern, master student at TJU
Haoyu Xu
A PyTorch implementation of EfficientDet.

A PyTorch impl of EfficientDet faithful to the original Google impl w/ ported weights

Ross Wightman 1.4k Jan 7, 2023
FAIR's research platform for object detection research, implementing popular algorithms like Mask R-CNN and RetinaNet.

Detectron is deprecated. Please see detectron2, a ground-up rewrite of Detectron in PyTorch. Detectron Detectron is Facebook AI Research's software sy

Facebook Research 25.5k Jan 7, 2023
An implementation of RetinaNet in PyTorch.

RetinaNet An implementation of RetinaNet in PyTorch. Installation Training COCO 2017 Pascal VOC Custom Dataset Evaluation Todo Credits Installation In

Conner Vercellino 297 Jan 4, 2023
PRTR: Pose Recognition with Cascade Transformers

PRTR: Pose Recognition with Cascade Transformers Introduction This repository is the official implementation for Pose Recognition with Cascade Transfo

mlpc-ucsd 133 Dec 30, 2022
Pytorch reimplement of the paper "A Novel Cascade Binary Tagging Framework for Relational Triple Extraction" ACL2020. The original code is written in keras.

CasRel-pytorch-reimplement Pytorch reimplement of the paper "A Novel Cascade Binary Tagging Framework for Relational Triple Extraction" ACL2020. The o

longlongman 170 Dec 1, 2022
CFNet: Cascade and Fused Cost Volume for Robust Stereo Matching(CVPR2021)

CFNet(CVPR 2021) This is the implementation of the paper CFNet: Cascade and Fused Cost Volume for Robust Stereo Matching, CVPR 2021, Zhelun Shen, Yuch

null 106 Dec 28, 2022
3D cascade RCNN for object detection on point cloud

3D Cascade RCNN This is the implementation of 3D Cascade RCNN: High Quality Object Detection in Point Clouds. We designed a 3D object detection model

Qi Cai 22 Dec 2, 2022
Automatic labeling, conversion of different data set formats, sample size statistics, model cascade

Simple Gadget Collection for Object Detection Tasks Automatic image annotation Conversion between different annotation formats Obtain statistical info

llt 4 Aug 24, 2022
Real-CUGAN - Real Cascade U-Nets for Anime Image Super Resolution

Real Cascade U-Nets for Anime Image Super Resolution 中文 | English ?? Real-CUGAN

tarsin 111 Dec 28, 2022
Fang Zhonghao 13 Nov 19, 2022
A PyTorch implementation of EfficientDet.

A PyTorch impl of EfficientDet faithful to the original Google impl w/ ported weights

Ross Wightman 1.4k Jan 7, 2023
FAIR's research platform for object detection research, implementing popular algorithms like Mask R-CNN and RetinaNet.

Detectron is deprecated. Please see detectron2, a ground-up rewrite of Detectron in PyTorch. Detectron Detectron is Facebook AI Research's software sy

Facebook Research 25.5k Jan 7, 2023
An implementation of RetinaNet in PyTorch.

RetinaNet An implementation of RetinaNet in PyTorch. Installation Training COCO 2017 Pascal VOC Custom Dataset Evaluation Todo Credits Installation In

Conner Vercellino 297 Jan 4, 2023
PRTR: Pose Recognition with Cascade Transformers

PRTR: Pose Recognition with Cascade Transformers Introduction This repository is the official implementation for Pose Recognition with Cascade Transfo

mlpc-ucsd 133 Dec 30, 2022
Pytorch reimplement of the paper "A Novel Cascade Binary Tagging Framework for Relational Triple Extraction" ACL2020. The original code is written in keras.

CasRel-pytorch-reimplement Pytorch reimplement of the paper "A Novel Cascade Binary Tagging Framework for Relational Triple Extraction" ACL2020. The o

longlongman 170 Dec 1, 2022
Motion detector, Full body detection, Upper body detection, Cat face detection, Smile detection, Face detection (haar cascade), Silverware detection, Face detection (lbp), and Sending email notifications

Security camera running OpenCV for object and motion detection. The camera will send email with image of any objects it detects. It also runs a server that provides web interface with live stream video.

Peace 10 Jun 30, 2021
CFNet: Cascade and Fused Cost Volume for Robust Stereo Matching(CVPR2021)

CFNet(CVPR 2021) This is the implementation of the paper CFNet: Cascade and Fused Cost Volume for Robust Stereo Matching, CVPR 2021, Zhelun Shen, Yuch

null 106 Dec 28, 2022
3D cascade RCNN for object detection on point cloud

3D Cascade RCNN This is the implementation of 3D Cascade RCNN: High Quality Object Detection in Point Clouds. We designed a 3D object detection model

Qi Cai 22 Dec 2, 2022
Cascade Drone Swarm Physical Demonstration Project

Cascade Drone Swarm Physical Demonstration Project Table of Contents About The Project Built With Getting Started Prerequisites Installation About The

null 3 Aug 24, 2022