All Projects → yl305237731 → flexible-yolov5

yl305237731 / flexible-yolov5

Licence: GPL-3.0 License
More readable and flexible yolov5 with more backbone(resnet, shufflenet, moblienet, efficientnet, hrnet, swin-transformer) and (cbam,dcn and so on), and tensorrt

Programming Languages

python
139335 projects - #7 most used programming language
Jupyter Notebook
11667 projects
Dockerfile
14818 projects

Projects that are alternatives of or similar to flexible-yolov5

detectron2 backbone
detectron2 backbone: resnet18, efficientnet, hrnet, mobilenet v2, resnest, bifpn
Stars: ✭ 171 (-39.36%)
Mutual labels:  backbone, efficientnet, hrnet
TensorMONK
A collection of deep learning models (PyTorch implemtation)
Stars: ✭ 21 (-92.55%)
Mutual labels:  resnet, shufflenet, efficientnet
Tensorrtx
Implementation of popular deep learning networks with TensorRT network definition API
Stars: ✭ 3,456 (+1125.53%)
Mutual labels:  resnet, tensorrt, yolov5
yolov5 tensorrt int8
TensorRT int8 量化部署 yolov5s 模型,实测3.3ms一帧!
Stars: ✭ 112 (-60.28%)
Mutual labels:  tensorrt, yolov5
YOLOv5-Multibackbone-Compression
YOLOv5 Series Multi-backbone(TPH-YOLOv5, Ghostnet, ShuffleNetv2, Mobilenetv3Small, EfficientNetLite, PP-LCNet, SwinTransformer YOLO), Module(CBAM, DCN), Pruning (EagleEye, Network Slimming) and Quantization (MQBench) Compression Tool Box.
Stars: ✭ 307 (+8.87%)
Mutual labels:  cbam, swin-transformer
food-detection-yolov5
🍔🍟🍗 Food analysis baseline with Theseus. Integrate object detection, image classification and multi-class semantic segmentation. 🍞🍖🍕
Stars: ✭ 68 (-75.89%)
Mutual labels:  efficientnet, yolov5
Pytorch Cifar100
Practice on cifar100(ResNet, DenseNet, VGG, GoogleNet, InceptionV3, InceptionV4, Inception-ResNetv2, Xception, Resnet In Resnet, ResNext,ShuffleNet, ShuffleNetv2, MobileNet, MobileNetv2, SqueezeNet, NasNet, Residual Attention Network, SENet, WideResNet)
Stars: ✭ 2,423 (+759.22%)
Mutual labels:  resnet, shufflenet
yolov5-deepsort-tensorrt
A c++ implementation of yolov5 and deepsort
Stars: ✭ 207 (-26.6%)
Mutual labels:  tensorrt, yolov5
YOLOv5-Lite
🍅🍅🍅YOLOv5-Lite: lighter, faster and easier to deploy. Evolved from yolov5 and the size of model is only 930+kb (int8) and 1.7M (fp16). It can reach 10+ FPS on the Raspberry Pi 4B when the input size is 320×320~
Stars: ✭ 1,230 (+336.17%)
Mutual labels:  tensorrt, yolov5
yolov5 tensorrt int8 tools
tensorrt int8 量化yolov5 onnx模型
Stars: ✭ 105 (-62.77%)
Mutual labels:  tensorrt, yolov5
ROS-Object-Detection-2Dto3D-RealsenseD435
Use the Intel D435 real-sensing camera to realize object detection based on the Yolov3-5 framework under the Opencv DNN(old version)/TersorRT(now) by ROS-melodic.Real-time display of the Pointcloud in the camera coordinate system.
Stars: ✭ 45 (-84.04%)
Mutual labels:  tensorrt, yolov5
yolov5 deepsort tensorrt cpp
This repo is a C++ version of yolov5_deepsort_tensorrt. Packing all C++ programs into .so files, using Python script to call C++ programs further.
Stars: ✭ 21 (-92.55%)
Mutual labels:  tensorrt, yolov5
awesome-computer-vision-models
A list of popular deep learning models related to classification, segmentation and detection problems
Stars: ✭ 419 (+48.58%)
Mutual labels:  resnet, efficientnet
Deepstream Project
This is a highly separated deployment project based on Deepstream , including the full range of Yolo and continuously expanding deployment projects such as Ocr.
Stars: ✭ 120 (-57.45%)
Mutual labels:  tensorrt, yolov5
ros-yolo-sort
YOLO v3, v4, v5, v6, v7 + SORT tracking + ROS platform. Supporting: YOLO with Darknet, OpenCV(DNN), OpenVINO, TensorRT(tkDNN). SORT supports python(original) and C++. (Not Deep SORT)
Stars: ✭ 162 (-42.55%)
Mutual labels:  tensorrt, yolov5
general backbone
No description or website provided.
Stars: ✭ 37 (-86.88%)
Mutual labels:  backbone, resnet
Segmentation models
Segmentation models with pretrained backbones. Keras and TensorFlow Keras.
Stars: ✭ 3,575 (+1167.73%)
Mutual labels:  resnet, efficientnet
Pytorch Image Models
PyTorch image models, scripts, pretrained weights -- ResNet, ResNeXT, EfficientNet, EfficientNetV2, NFNet, Vision Transformer, MixNet, MobileNet-V3/V2, RegNet, DPN, CSPNet, and more
Stars: ✭ 15,232 (+5301.42%)
Mutual labels:  resnet, efficientnet
simpleAICV-pytorch-ImageNet-COCO-training
SimpleAICV:pytorch training example on ImageNet(ILSVRC2012)/COCO2017/VOC2007+2012 datasets.Include ResNet/DarkNet/RetinaNet/FCOS/CenterNet/TTFNet/YOLOv3/YOLOv4/YOLOv5/YOLOX.
Stars: ✭ 276 (-2.13%)
Mutual labels:  resnet, yolov5
CBAM-tensorflow-slim
CBAM implementation on TensorFlow Slim
Stars: ✭ 104 (-63.12%)
Mutual labels:  resnet, cbam

flexible-yolov5

Based on ultralytics/yolov5.

The original Yolo V5 was an amazing project. When I want to make some changes to the network, it's not so easy, such as adding branches and trying other backbones. Maybe there are people like me, so I split the yolov5 model to {backbone, neck, head} to facilitate the operation of various modules and support more backbones.Basically, I only changed the model, and I didn't change the architecture, training and testing of yolov5. Therefore, if the original code is updated, it is also very convenient to update this code. if this repo can help you, please give me a star.

Table of contents

Features

  • Reorganize model structure, such as backbone, neck, head, can modify the network flexibly and conveniently
  • mobilenetV3-small, mobilenetV3-large
  • shufflenet_v2_x0_5, shufflenet_v2_x1_0, shufflenet_v2_x1_5, shufflenet_v2_x2_0
  • yolov5s, yolov5m, yolov5l, yolov5x, yolov5transformer
  • resnet18, resnet50, resnet34, resnet101, resnet152
  • efficientnet_b0 - efficientnet_b8, efficientnet_l2
  • hrnet 18,32,48
  • CBAM, SE
  • swin transformer - base, tiny, small, large (please set half=False in scripts/eval.py and don't use model.half in train.py)
  • DCN (mixed precision training not support, if you want use dcn, please close amp in line 292 of scripts/train.py)
  • coord conv
  • drop_block
  • vgg, repvgg

Notices

  • The CBAM, SE, DCN, coord conv. At present, the above plug-ins are not added to all networks, so you may need to modify the code yourself.
  • The default gw and gd for PAN and FPN of other backbone are same as yolov5_s, so if you want a strong model, please modify self.gw and self.gd in FPN and PAN.

Prerequisites

please refer requirements.txt

Getting Started

Dataset Preparation

Make data for yolov5 format. you can use od/data/transform_voc.py convert VOC data to yolov5 data format.

Training and Testing

For training and Testing, it's same like yolov5.

Training

  1. check out configs/data.yaml, and replace with your data, and number of object nc
  2. check out configs/model_*.yaml, choose backbone. and change nc to your dataset. please refer support_backbone in models.backbone.init.py
$ python scripts/train.py  --batch 16 --epochs 5 --data configs/data.yaml --cfg confgis/model_XXX.yaml

A google colab demo in train_demo.ipynb

Testing and Visualize

$ python scripts/eval.py   --data configs/data.yaml  --weights runs/train/yolo/weights/best.py

Baseline Pretrained Checkpoints

Because the training takes too much time, each model has only trained 150 epoch on coco2014. You can download it to continue training, and the model can continue to converge. The following model is different only from the backbone network, which is compared with yolov5s. The following table can be used as a performance comparison.

All model in BaiduNetDisk.

doing

Model size mAPval
0.5:0.95
mAPval
0.5
params
YOLOv5s[提取码: 7vuv] 640 31.3 51.4 9543197
YOLOv5s_c3tr[提取码: oph6] 640 29 49.1 7264669
mobilenetv3-small[提取码: qi77] 640 21 37.6 5360221
shufflenetv2-x1_0[提取码: e3jk] 640 27 45.9 6660449
resnet-18[提取码:1ovj] 640 30 49.6 14301501
[hrnet-18][] 640
[vgg-16_bn][] 640
[swin-tiny][] 640
[efficientnet-b0][] 640
repvgg-A0[提取码: 6sok] 640 0.2927 0.4834 11526269

Detection

see detector.py

Deploy

For tf_serving or triton_server, you can set model.detection.export = False in scripts/deploy/export.py in line 50 to export an onnx model, A new output node will be added to combine the three detection output nodes into one. For Official tensorrt converter, you should set model.detection.export = True, because ScatterND op not support by trt. For this repo, best use official tensorrt converter, not tensorrtx

Quantization

You can directly quantify the onnx model

python scripts/trt_quant/convert_trt_quant.py  --img_dir  /XXXX/train/  --img_size 640 --batch_size 6 --batch 200 --onnx_model runs/train/exp1/weights/bast.onnx  --mode int8

See

trt python infer demo scripts/trt_quant/trt_infer.py

bugs fixed

  • resnet with dcn, training on gpu *RuntimeError: expected scalar type Half but found Float
  • swin-transformer, training is ok, but testing report *RuntimeError: expected object of scalar type Float but got scalar type Half for argument #2 'mat2' in call to_th_bmm_out in swin_trsansformer.py 143
  • mobilenet export onnx failed, please replace HardSigmoid() by others, because onnx don't support pytorch nn.threshold

Reference

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].