• Stars
    star
    217
  • Rank 182,446 (Top 4 %)
  • Language
    Python
  • License
    GNU General Publi...
  • Created almost 3 years ago
  • Updated about 2 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

multi-task yolov5 with detection and segmentation

YOLOv5DS

Multi-task yolov5 with detection and segmentation based on yolov5(branch v6.0)

  • decoupled head
  • anchor free
  • segmentation head

README中文

Ablation experiment

All experiments is trained on a small dataset with 47 classes ,2.6k+ images for training and 1.5k+ images for validation:

model P R [email protected] [email protected]:95
yolov5s 0.536 0.368 0.374 0.206
yolov5s+train scrach 0.452 0.314 0.306 0.152
yolov5s+decoupled head 0.555 0.375 0.387 0.214
yolov5s + decoupled head+class balance weights 0.541 0.392 0.396 0.217
yolov5s + decoupled head+class balance weights 0.574 0.386 0.403 0.22
yolov5s + decoupled head+seghead 0.533 0.383 0.396 0.212

The baseline model is yolov5s. triks like decoupled head, add class balance weights all help to improve MAP.

Adding a segmentation head can still get equivalent MAP as single detection model.

Training Method

python trainds.py

As VOC dataset do not offer the box labels and mask labels for all images, so we forward this model with a detection batch and a segmention batch by turns, and accumulate the gradient , than update the whole model parameters.

MAP

To compare with the SSD512, we use VOC07+12 training set as the detection training set, VOC07 test data as detection test data, for segmentation ,we use VOC12 segmentation datset as training and test set.

the input size is 512(letter box).

model VOC2007 test
SSD512 79.8
yolov5s+seghead(512) 79.2

The above results only trained less than 200 epoch, weights

demo

see detectds.py.

Train custom data

  1. Use labelme to label box and mask on your dataset;

    the box label format is voc, you can use voc2yolo.py to convert to yolo format,

    the mask label is json files , you should convert to mask .png image labels,like VOC2012 segmentation labels.

  2. see how to arrange your detection dataset with yolov5 , then arrange your segmentation dataset same as yolo files , see data/voc.yaml:

    
    # Train/val/test sets as 1) dir: path/to/imgs, 2) file: path/to/imgs.txt, or 3) list: [path/to/imgs1, path/to/imgs2, ..]
    path: .  # dataset root dir
    train: VOC/det/images/train  # train images (relative to 'path') 118287 images
    val: VOC/det/images/test  # train images (relative to 'path') 5000 images
    road_seg_train: VOC/seg/images/train   # road segmentation data
    road_seg_val: VOC/seg/images/val
    
    # Classes
    nc: 20  # number of classes
    segnc: 20
    
    names: ['aeroplane', 'bicycle', 'bird', 'boat',
               'bottle', 'bus', 'car', 'cat', 'chair',
               'cow', 'diningtable', 'dog', 'horse',
               'motorbike', 'person', 'pottedplant',
               'sheep', 'sofa', 'train', 'tvmonitor']  # class names
    
    segnames: ['aeroplane', 'bicycle', 'bird', 'boat',
               'bottle', 'bus', 'car', 'cat', 'chair',
               'cow', 'diningtable', 'dog', 'horse',
               'motorbike', 'person', 'pottedplant',
               'sheep', 'sofa', 'train', 'tvmonitor']
    
    1. change the config in trainds.py and :
    python trainds.py 
    
    1. test image folder with :

      python detectds.py
      

Reference

  1. YOLOP: You Only Look Once for Panoptic Driving Perception
  2. yolov5

Blogs

  1. https://blog.csdn.net/IEEE_FELLOW/article/details/121912670?spm=1001.2014.3001.5502
  2. https://blog.csdn.net/qq_57076285/article/details/124265887
  3. https://blog.csdn.net/sadjhaksdas/article/details/125762260
  4. https://blog.csdn.net/LWD19981223/article/details/125921793

More Repositories

1

yolov5prune

Python
547
star
2

FireSmokeDetectionByEfficientNet

Fire and smoke classification and detection using efficientnet
Python
98
star
3

yolov5ncnn

ncnn of yolov5 v5.0 branch
C++
85
star
4

facelandmarks

light-weight 98 points face landmark超轻98点人脸关键点检测模型
Python
59
star
5

SSD.Pytorch

Pytorch implementation of SSD512
Python
51
star
6

DDRNet.TensorRT

TensorRT of DDRNet for real-time segmentation
C++
38
star
7

LightWeightFaceDetector

Ultra Light Weight Face Detection with Landmark
Python
36
star
8

98-FaceLandmarks

98 landmark detection
Python
32
star
9

PPLiteSeg.pytorch

pytorch of the SOTA real-time segmentation network ppliteseg
Python
19
star
10

facedetection_android.pytorch

Light-weight face detection on Android with pytorch model
Java
19
star
11

PlateKeyPointRegression

车牌关键点定位,全卷积网络预测车牌16个关键点位置
Jupyter Notebook
16
star
12

DDRNet.Pytorch

Python
15
star
13

RefineNet_TensorRT

TensorRT for RefineNet Segmentation
C++
11
star
14

FaceSegAttribute

Face segmentation,72 landmarks,attribute recoginition and face detection;人脸分割关键点识别,年龄预测,性别识别等
Jupyter Notebook
11
star
15

RefineNet

Pytorch refinenet for segmentation and pytorch -> onnx -> tensorrt
Python
9
star
16

Face-Dataset

face dataset for segmentation, 72 landmarks, age , gender, expression , face detection.
8
star
17

YOLO-v3-caffe

caffe model of YOLO v3
C++
7
star
18

resnet-caffe

resnet18 trained from scrach on ImageNet
Python
6
star
19

PIDNet.TensorRT

TensorRT project of PIDNet
C++
6
star
20

CRNN.Pytorch

Pytorch CRNN for text recognition
Python
2
star