Underwater industrial application yolov5m6

Overview

underwater-industrial-application-yolov5m6

This project wins the intelligent algorithm contest finalist award and stands out from over 2000teams in China Underwater Robot Professional Contest, entering the final of China Underwater Robot Professional Contest and ranking 13 out of 31 teams in finals.

和鲸社区Kesci 水下光学目标检测产业应用赛项

环境:

mmdetection

+ 操作系统:Ubuntu 18.04.2
+ GPU:1块2080Ti
+ Python:Python 3.7.7
+ NVIDIA依赖:
    - NVCC: Cuda compilation tools, release 10.1, V10.1.243
    - CuDNN 7.6.5
+ 深度学习框架:
    - PyTorch: 1.8.1
    - TorchVision: 0.9.1
    - OpenCV
    - MMCV
    - MMDetection(注意data clean 的版本不同)

yolov5

训练环境:
	+ 操作系统:Ubuntu 18.04.2
	+ GPU:1块2080Ti
	+ Python:Python 3.7.7
测试环境:
	 NVIDIA Jetson AGX Xavier


# pip install -r requirements.txt

# base ----------------------------------------
matplotlib>=3.2.2
numpy>=1.18.5
opencv-python>=4.1.2
Pillow
PyYAML>=5.3.1
scipy>=1.4.1
torch>=1.7.0
torchvision>=0.8.1
tqdm>=4.41.0

# logging -------------------------------------
tensorboard>=2.4.1
# wandb

# plotting ------------------------------------
seaborn>=0.11.0
pandas

# export --------------------------------------
# coremltools>=4.1
# onnx>=1.9.0
# scikit-learn==0.19.2  # for coreml quantization
# tensorflow==2.4.1  # for TFLite export

# extras --------------------------------------
# Cython  # for pycocotools https://github.com/cocodataset/cocoapi/issues/172
# pycocotools>=2.0  # COCO mAP
# albumentations>=1.0.3
thop  # FLOPs computation

第一大步:@数据清理

文件说明:data_clean_Code用于数据清理

data_clean_Code/yangtiming-underwater-master ->为湛江赛拿第20名方案
data_clean_Code/underwater-detection-master  ->为triks团队湛江赛方案

使用说明

1. (这一步用我的yangtiming-underwater-master替代原有的cascade_rcnn_x101_64x4d_fpn_dcn_e15 )【原因精度更高A榜0.562】

模型采用 cascade_rcnn_x101_64x4d_fpn_dcn_e15  
+ Backbone:
    + ResNeXt101-64x4d
+ Neck:
    + FPN
+ DCN
+ Global context(GC)
+ MS [(4096, 600), (4096, 1000)]
+ RandomRotate90°
+ 15epochs + step:[11, 13]  
+ A榜:0.55040585 
    + 注:不是所有数据

2. 基于1训练好的模型对训练数据进行清洗(tools/data_process/data_clean.py)

+ 1. 如果某张图片上所有预测框的confidence没有一个是大于0.9, 那么去掉该图片(即看不清的图片)
+ 2. 修正错误标注
    + 1. 先过滤掉confidence<0.1的predict boxes, 然后同GT boxes求iou
    + 2. 如果predict box同GT的最大iou大于0.6,但类别不一致, 那么就修正该gt box的类别
trainall.json (与bbox1)修后的到   trainall-revised.json

3. 基于2修正后的数据进行训练->(基于2修正后的到 trainall-revised.json 修正采用cascade_rcnn_r50_rfp_sac后的到-> bbox3

模型采用cascade_rcnn_r50_rfp_sac
+ Backbone:
+ ResNet50
+ Neck:
RFP-SAC
+ GC + MS + RandomRotate90°
+ cascade_iou调整为:(0.55, 0.65, 0.75)
+ A榜: 0.56339531
+ 注:所有数据

4. 基于3训练好的模型进一步清洗数据.

->  trainall-revised-v3.json(与bbox3) 	进一步清洗数据 -> trainall-revised-v4.json)
+ 模型同3: 
+ A榜:0.56945031
    + 注:所有数据
在验证集上面测试精度:1. 执行完mAP0.5:0.95=0.547 4. 执行完mAP0.5:0.95 = 0.560

第二大步:@数据清理完毕后,改用yolov5 (code/yolov5_V5_chuli_focal_loss_attention)

使用背景介绍:
使用模型为yolov5m6系列,迭代tricks的时候,采取用--img 640 进行迭代

最优模型:

最终在yolov5m6上面的精度为:mAP0.5:0.95= 0.5374,agx速度0.2s每张
最好模型:
1.yolov5m6
2.数据清洗
2.attention模块:senet
3.hsv_h,hsv_s,hsv_v=0
4.focal_loss

使用的tricks如下:(按照时间顺序)

1.按照第一大步的数据清洗:由原来的mAP0.5:0.95= 0.465->0.4880
2.yolov5当中的hsv_h,hsv_s,hsv_v均设为0,mAP0.5:0.95= 0.4880 ->0.4940
3.在loss.py当中加入focal_loss损失函数(157行,172行),mAP0.5:0.95= 0.4940 ->0.4977
4.更改原有yolov5的c3层改为senet(attention模块),mAP0.5:0.95= 0.4977 -> 0.50069

以上按照

python train.py  --weights weights/yolov5m6.pt --cfg models/hub/yolov5m6-senet.yaml --data data/underwater.yaml  --hyp data/hyps/hyp.scratch-p6.yaml --epochs 100 --batch-size 25 --img 640

最终要提交的时候,按照

python train.py  --weights weights/yolov5m6.pt --cfg models/hub/yolov5m6-senet.yaml --data data/underwater.yaml  --hyp data/hyps/hyp.scratch-p6.yaml --epochs 250 --batch-size 4 --img 1280 --multi-scale

【注意:multi-scale大小可以在train.py文件夹下面更改】

测试

python3 val_tm_txt_csv.py --data  /data/underwater.yaml   --weights weights/best_05374.pt --img 1280 --save-txt --save-conf --half

【--half能提升速度(fp16),精度比fp32更高】

################

若要测试mAP,可以用 https://github.com/rafaelpadilla/review_object_detection_metrics.git

以下为比赛文档说明

若有权限问题,则执行前 chmod +x main_test.sh

1. 将测试集的图片放在本文件夹当中名字为test
2.最终结果将放在answer当中(执行后自动生成)
3.code文件夹为全部代码,以及包含训练权重
4.执行main_test.sh开始运行



(*)Q:何时开始计时?(注意:在执行main_test.sh之前命令窗口拉长,否则计时无法看到进度条)
当执行 python3 ./val_tm_txt_csv.py 时,看见如下界面表示计时开始
##                 Class     Images     Labels          P          R     [email protected] [email protected]:.95:   0%|          | 0/xxx [00:00

reference

+yolov5

+yangtiming/underwater-mmdetection

+team-tricks

Deep Learning for Natural Language Processing SS 2021 (TU Darmstadt)

Deep Learning for Natural Language Processing SS 2021 (TU Darmstadt) Task Training huge unsupervised deep neural networks yields to strong progress in

Oliver Hahn 1 Jan 26, 2022
A new video text spotting framework with Transformer

TransVTSpotter: End-to-end Video Text Spotter with Transformer Introduction A Multilingual, Open World Video Text Dataset and End-to-end Video Text Sp

weijiawu 67 Jan 03, 2023
GNNAdvisor: An Efficient Runtime System for GNN Acceleration on GPUs

GNNAdvisor: An Efficient Runtime System for GNN Acceleration on GPUs [Paper, Slides, Video Talk] at USENIX OSDI'21 @inproceedings{GNNAdvisor, title=

YUKE WANG 47 Jan 03, 2023
OpenCVのGrabCut()を利用したセマンティックセグメンテーション向けアノテーションツール(Annotation tool using GrabCut() of OpenCV. It can be used to create datasets for semantic segmentation.)

[Japanese/English] GrabCut-Annotation-Tool GrabCut-Annotation-Tool.mp4 OpenCVのGrabCut()を利用したアノテーションツールです。 セマンティックセグメンテーション向けのデータセット作成にご使用いただけます。 ※Grab

KazuhitoTakahashi 30 Nov 18, 2022
A simple program for training and testing vit

Vit This is a simple program for training and testing vit. Key requirements: torch, torchvision and timm. Dataset I put 5 categories of the cub classi

xiezhenyu 2 Oct 11, 2022
QICK: Quantum Instrumentation Control Kit

QICK: Quantum Instrumentation Control Kit The QICK is a kit of firmware and software to use the Xilinx RFSoC to control quantum systems. It consists o

81 Dec 15, 2022
Visualizer for neural network, deep learning, and machine learning models

Netron is a viewer for neural network, deep learning and machine learning models. Netron supports ONNX (.onnx, .pb, .pbtxt), Keras (.h5, .keras), Tens

Lutz Roeder 21k Jan 06, 2023
Sequence to Sequence Models with PyTorch

Sequence to Sequence models with PyTorch This repository contains implementations of Sequence to Sequence (Seq2Seq) models in PyTorch At present it ha

Sandeep Subramanian 708 Dec 19, 2022
Short and long time series classification using convolutional neural networks

time-series-classification Short and long time series classification via convolutional neural networks In this project, we present a novel framework f

35 Oct 22, 2022
Help you understand Manual and w/ Clutch point while driving.

简体中文 forza_auto_gear forza_auto_gear is a tool for Forza Horizon 5. It will help us understand the best gear shift point using Manual or w/ Clutch in

15 Oct 08, 2022
Weakly Supervised Segmentation by Tensorflow.

Weakly Supervised Segmentation by Tensorflow. Implements semantic segmentation in Simple Does It: Weakly Supervised Instance and Semantic Segmentation, by Khoreva et al. (CVPR 2017).

CHENG-YOU LU 52 Dec 27, 2022
PyTorch reimplementation of the paper Involution: Inverting the Inherence of Convolution for Visual Recognition [CVPR 2021].

Involution: Inverting the Inherence of Convolution for Visual Recognition Unofficial PyTorch reimplementation of the paper Involution: Inverting the I

Christoph Reich 100 Dec 01, 2022
Continual reinforcement learning baselines: experiment specifications, implementation of existing methods, and common metrics. Easily extensible to new methods.

Continual Reinforcement Learning This repository provides a simple way to run continual reinforcement learning experiments in PyTorch, including evalu

55 Dec 24, 2022
Code for paper "Extract, Denoise and Enforce: Evaluating and Improving Concept Preservation for Text-to-Text Generation" EMNLP 2021

The repo provides the code for paper "Extract, Denoise and Enforce: Evaluating and Improving Concept Preservation for Text-to-Text Generation" EMNLP 2

Yuning Mao 18 May 24, 2022
Implementation of Feedback Transformer in Pytorch

Feedback Transformer - Pytorch Simple implementation of Feedback Transformer in Pytorch. They improve on Transformer-XL by having each token have acce

Phil Wang 93 Oct 04, 2022
GraphRNN: Generating Realistic Graphs with Deep Auto-regressive Models

GraphRNN: Generating Realistic Graphs with Deep Auto-regressive Model This repository is the official PyTorch implementation of GraphRNN, a graph gene

Jiaxuan 568 Dec 29, 2022
Leibniz is a python package which provide facilities to express learnable partial differential equations with PyTorch

Leibniz is a python package which provide facilities to express learnable partial differential equations with PyTorch

Beijing ColorfulClouds Technology Co.,Ltd. 16 Aug 07, 2022
Metrics to evaluate quality and efficacy of synthetic datasets.

An Open Source Project from the Data to AI Lab, at MIT Metrics for Synthetic Data Generation Projects Website: https://sdv.dev Documentation: https://

The Synthetic Data Vault Project 129 Jan 03, 2023
Transfer Learning Shootout for PyTorch's model zoo (torchvision)

pytorch-retraining Transfer Learning shootout for PyTorch's model zoo (torchvision). Load any pretrained model with custom final layer (num_classes) f

Alexander Hirner 169 Jun 29, 2022
Barbershop: GAN-based Image Compositing using Segmentation Masks (SIGGRAPH Asia 2021)

Barbershop: GAN-based Image Compositing using Segmentation Masks Barbershop: GAN-based Image Compositing using Segmentation Masks Peihao Zhu, Rameen A

Peihao Zhu 928 Dec 30, 2022