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

Character-Input - Create a program that asks the user to enter their name and their age

Character-Input Create a program that asks the user to enter their name and thei

PyLaboratory 0 Feb 06, 2022
LexGLUE: A Benchmark Dataset for Legal Language Understanding in English

LexGLUE: A Benchmark Dataset for Legal Language Understanding in English ⚖️ 🏆 🧑‍🎓 👩‍⚖️ Dataset Summary Inspired by the recent widespread use of th

95 Dec 08, 2022
Unofficial PyTorch implementation of Fastformer based on paper "Fastformer: Additive Attention Can Be All You Need"."

Fastformer-PyTorch Unofficial PyTorch implementation of Fastformer based on paper Fastformer: Additive Attention Can Be All You Need. Usage : import t

Hong-Jia Chen 126 Dec 06, 2022
Implementation of "Efficient Regional Memory Network for Video Object Segmentation" (Xie et al., CVPR 2021).

RMNet This repository contains the source code for the paper Efficient Regional Memory Network for Video Object Segmentation. Cite this work @inprocee

Haozhe Xie 76 Dec 14, 2022
AgeGuesser: deep learning based age estimation system. Powered by EfficientNet and Yolov5

AgeGuesser AgeGuesser is an end-to-end, deep-learning based Age Estimation system, presented at the CAIP 2021 conference. You can find the related pap

5 Nov 10, 2022
Geometric Vector Perceptron --- a rotation-equivariant GNN for learning from biomolecular structure

Geometric Vector Perceptron Code to accompany Learning from Protein Structure with Geometric Vector Perceptrons by B Jing, S Eismann, P Suriana, RJL T

Dror Lab 85 Dec 29, 2022
Code base of object detection

rmdet code base of object detection. 环境安装: 1. 安装conda python环境 - `conda create -n xxx python=3.7/3.8` - `conda activate xxx` 2. 运行脚本,自动安装pytorch1

3 Mar 08, 2022
Portfolio asset allocation strategies: from Markowitz to RNNs

Portfolio asset allocation strategies: from Markowitz to RNNs Research project to explore different approaches for optimal portfolio allocation starti

Luigi Filippo Chiara 1 Feb 05, 2022
FaceAnon - Anonymize people in images and videos using yolov5-crowdhuman

Face Anonymizer Blur faces from image and video files in /input/ folder. Require

22 Nov 03, 2022
Image Fusion Transformer

Image-Fusion-Transformer Platform Python 3.7 Pytorch =1.0 Training Dataset MS-COCO 2014 (T.-Y. Lin, M. Maire, S. Belongie, J. Hays, P. Perona, D. Ram

Vibashan VS 68 Dec 23, 2022
Implementation of the Swin Transformer in PyTorch.

Swin Transformer - PyTorch Implementation of the Swin Transformer architecture. This paper presents a new vision Transformer, called Swin Transformer,

597 Jan 03, 2023
PyTorch Implementation for "ForkGAN with SIngle Rainy NIght Images: Leveraging the RumiGAN to See into the Rainy Night"

ForkGAN with Single Rainy Night Images: Leveraging the RumiGAN to See into the Rainy Night By Seri Lee, Department of Engineering, Seoul National Univ

Seri Lee 52 Oct 12, 2022
YuNetのPythonでのONNX、TensorFlow-Lite推論サンプル

YuNet-ONNX-TFLite-Sample YuNetのPythonでのONNX、TensorFlow-Lite推論サンプルです。 TensorFlow-LiteモデルはPINTO0309/PINTO_model_zoo/144_YuNetのものを使用しています。 Requirement Op

KazuhitoTakahashi 8 Nov 17, 2021
ML-Decoder: Scalable and Versatile Classification Head

ML-Decoder: Scalable and Versatile Classification Head Paper Official PyTorch Implementation Tal Ridnik, Gilad Sharir, Avi Ben-Cohen, Emanuel Ben-Baru

189 Jan 04, 2023
[ACM MM 2021] Multiview Detection with Shadow Transformer (and View-Coherent Data Augmentation)

Multiview Detection with Shadow Transformer (and View-Coherent Data Augmentation) [arXiv] [paper] @inproceedings{hou2021multiview, title={Multiview

Yunzhong Hou 27 Dec 13, 2022
Benchmark library for high-dimensional HPO of black-box models based on Weighted Lasso regression

LassoBench LassoBench is a library for high-dimensional hyperparameter optimization benchmarks based on Weighted Lasso regression. Note: LassoBench is

Kenan Šehić 5 Mar 15, 2022
A Closer Look at Invalid Action Masking in Policy Gradient Algorithms

A Closer Look at Invalid Action Masking in Policy Gradient Algorithms This repo contains the source code to reproduce the results in the paper A Close

Costa Huang 73 Dec 24, 2022
Camera-caps - Examine the camera capabilities for V4l2 cameras

camera-caps This is a graphical user interface over the v4l2-ctl command line to

Jetsonhacks 25 Dec 26, 2022
Spatial-Location-Constraint-Prototype-Loss-for-Open-Set-Recognition

Spatial Location Constraint Prototype Loss for Open Set Recognition Official PyTorch implementation of "Spatial Location Constraint Prototype Loss for

Xia Ziheng 12 Jun 24, 2022
Create images and texts with the First Order Generative Adversarial Networks

First Order Divergence for training GANs This repository contains code accompanying the paper First Order Generative Advesarial Netoworks The majority

Zalando Research 35 Dec 11, 2021