• Stars
    star
    3,116
  • Rank 14,427 (Top 0.3 %)
  • Language
    Python
  • License
    GNU General Publi...
  • Created over 3 years ago
  • Updated 12 months ago

Reviews

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

Repository Details

🔥🔥🔥🔥 (Earlier YOLOv7 not official one) YOLO with Transformers and Instance Segmentation, with TensorRT acceleration! 🔥🔥🔥

this is another yolov7 implementation based on detectron2, YOLOX, YOLOv6, YOLOv5, DETR, Anchor-DETR, DINO and some other SOTA detection models also supported. The ultimate goal of yolov7-d2 is to build a powerful weapon for anyone who wants a SOTA detector and train it without pain. It's extremly easy for users to build any Multi-Head models on yolov7-d2, for example, our E2E pose estimation is build on yolov7-d2 and works very well.

Thanks for Aarohi's youtube vlog for guaidance of yolov7: https://www.youtube.com/watch?v=ag88beS_fvM , if you want a quick start, take a look at this nice introduction on yolov7 and detectron2.

New version will release!

YOLOv7 v2.0 will be released soon! We will release our Convext-tiny YOLO arch model achieves mAP 43.9 with very low latency! Feature will be included in next version:

  • Support EfficientFormer backbone;
  • Support new YOLO2Go model, more lighter, much more faster and much more accurate;
  • Support MobileOne backbone;

For more details, refer to read the doc.

Just fork and star!, you will be noticed once we release the new version!

🔥🔥🔥 Just another yolo variant implemented based on detectron2. But note that YOLOv7 isn't meant to be a successor of yolo family, 7 is just a magic and lucky number. Instead, YOLOv7 extends yolo into many other vision tasks, such as instance segmentation, one-stage keypoints detection etc..

The supported matrix in YOLOv7 are:

  • YOLOv4 contained with CSP-Darknet53;
  • YOLOv7 arch with resnets backbone;
  • YOLOv7 arch with resnet-vd backbone (likely as PP-YOLO), deformable conv, Mish etc;
  • GridMask augmentation from PP-YOLO included;
  • Mosiac transform supported with a custom datasetmapper;
  • YOLOv7 arch Swin-Transformer support (higher accuracy but lower speed);
  • YOLOv7 arch Efficientnet + BiFPN;
  • YOLOv5 style positive samples selection, new coordinates coding style;
  • RandomColorDistortion, RandomExpand, RandomCrop, RandomFlip;
  • CIoU loss (DIoU, GIoU) and label smoothing (from YOLOv5 & YOLOv4);
  • YOLOF also included;
  • YOLOv7 Res2net + FPN supported;
  • Pyramid Vision Transformer v2 (PVTv2) supported;
  • WBF (Weighted Box Fusion), this works better than NMS, link;
  • YOLOX like head design and anchor design, also training support;
  • YOLOX s,m,l backbone and PAFPN added, we have a new combination of YOLOX backbone and pafpn;
  • YOLOv7 with Res2Net-v1d backbone, we found res2net-v1d have a better accuracy then darknet53;
  • Added PPYOLOv2 PAN neck with SPP and dropblock;
  • YOLOX arch added, now you can train YOLOX model (anchor free yolo) as well;
  • DETR: transformer based detection model and onnx export supported, as well as TensorRT acceleration;
  • AnchorDETR: Faster converge version of detr, now supported!
  • Almost all models can export to onnx;
  • Supports TensorRT deployment for DETR and other transformer models;
  • It will integrate with wanwu, a torch-free deploy framework run fastest on your target platform.

⚠️ Important note: YOLOv7 on Github not the latest version, many features are closed-source but you can get it from https://manaai.cn

Features are ready but not opensource yet:

  • Convnext training on YOLOX, higher accuracy than original YOLOX;
  • GFL loss support;
  • MobileVit-V2 backbone available;
  • CSPRep-Resnet: a repvgg style resnet used in PP-YOLOE but in pytorch rather than paddle;
  • VitDet support;
  • Simple-FPN support from VitDet;
  • PP-YOLOE head supported;

If you want get full version YOLOv7, either become a contributor or get from https://manaai.cn .

🆕 News!

  • 2022.08.20: Our new lightweighted model MobileOne-S0-YOLOX-Lite achieves mAP 30! surpressed yolox-nano or other lightweighted CPU models!
  • 2022.07.26: Now we are preparing release new pose model;
  • 2022.06.25: Meituan's YOLOv6 training has been supported in YOLOv7!
  • 2022.06.13: New model YOLOX-Convnext-tiny got a 41.3 43 mAP beats yolox-s, AP-small even higher!;
  • 2022.06.09: GFL, general focal loss supported;
  • 2022.05.26: Added YOLOX-ConvNext config;
  • 2022.05.18: DINO, DNDetr and DABDetr are about added, new records on coco up to 63.3 AP!
  • 2022.05.09: Big new function added! We adopt YOLOX with Keypoints Head!, model still under train, but you can check at code already;
  • 2022.04.23: We finished the int8 quantization on SparseInst! It works perfect! Download the onnx try it our by your self.
  • 2022.04.15: Now, we support the SparseInst onnx expport!
  • 2022.03.25: New instance seg supported! 40 FPS @ 37 mAP!! Which is fast;
  • 2021.09.16: First transformer based DETR model added, will explore more DETR series models;
  • 2021.08.02: YOLOX arch added, you can train YOLOX as well in this repo;
  • 2021.07.25: We found YOLOv7-Res2net50 beat res50 and darknet53 at same speed level! 5% AP boost on custom dataset;
  • 2021.07.04: Added YOLOF and we can have a anchor free support as well, YOLOF achieves a better trade off on speed and accuracy;
  • 2021.06.25: this project first started.
  • more

🌹 Contribution Wanted

If you have spare time or if you have GPU card, then help YOLOv7 become more stronger! Here is the guidance of contribute:

  1. Claim task: I have some ideas but do not have enough time to do it, if you want to implement it, claim the task, I will give u detailed advise on how to do, and you can learn a lot from it;
  2. Test mAP: When you finished new idea implementation, create a thread to report experiment mAP, if it work, then merge into our main master branch;
  3. Pull request: YOLOv7 is open and always tracking on SOTA and light models, if a model is useful, we will merge it and deploy it, distribute to all users want to try.

Here are some tasks need to be claimed:

Just join our in-house contributor plan, you can share our newest code with your contribution!

Quick Start

Before running yolov7-d2, make sure you have detectron2 installed, for it's installation, please refer to original facebookresearch repo.

Simple pip install -e . you can have detectron2 installed from source.

Then, just clone this repo:

git clone https://github.com/jinfagang/yolov7_d2
cd yolov7_d2
pip install -e .

Or, you can pip install yolov7-d2 for quick install from pypi.

Then following docs for first training && inference usage.

💁‍♂️ Results

YOLOv7 Instance Face & Detection

🧑‍🦯 Installation && Quick Start

Special requirements (other version may also work, but these are tested, with best performance, including ONNX export best support):

  • torch 1.11 (stable version)
  • onnx
  • onnx-simplifier 0.3.7
  • alfred-py latest
  • detectron2 latest

If you using lower version torch, onnx exportation might not work as our expected.

🤔 Features

Some highlights of YOLOv7 are:

  • A simple and standard training framework for any detection && instance segmentation tasks, based on detectron2;
  • Supports DETR and many transformer based detection framework out-of-box;
  • Supports easy to deploy pipeline thought onnx.
  • This is the only framework support YOLOv4 + InstanceSegmentation in single stage style;
  • Easily plugin into transformers based detector;

We are strongly recommend you send PR if you have any further development on this project, the only reason for opensource it is just for using community power to make it stronger and further. It's very welcome for anyone contribute on any features!

🧙‍♂️ Pretrained Models

model backbone input aug APval AP FPS weights
SparseInst R-50 640 32.8 - 44.3 model
SparseInst R-50-vd 640 34.1 - 42.6 model
SparseInst (G-IAM) R-50 608 33.4 - 44.6 model
SparseInst (G-IAM) R-50 608 34.2 34.7 44.6 model
SparseInst (G-IAM) R-50-DCN 608 36.4 36.8 41.6 model
SparseInst (G-IAM) R-50-vd 608 35.6 36.1 42.8 model
SparseInst (G-IAM) R-50-vd-DCN 608 37.4 37.9 40.0 model
SparseInst (G-IAM) R-50-vd-DCN 640 37.7 38.1 39.3 model
SparseInst Int8 onnx google drive

🧙‍♂️ Models trained in YOLOv7

model backbone input aug AP AP50 APs FPS weights
YoloFormer-Convnext-tiny Convnext-tiny 800 43 63.7 26.5 39.3 model
YOLOX-s - 800 40.5 - - 39.3 model

note: We post AP-s here because we want to know how does small object performance in related model, it was notablely higher small-APs for transformer backbone based model! Some of above model might not opensourced but we provide weights.

🥰 Demo

Run a quick demo would be like:

python3 demo.py --config-file configs/wearmask/darknet53.yaml --input ./datasets/wearmask/images/val2017 --opts MODEL.WEIGHTS output/model_0009999.pth

Run a quick demo to upload and explore your YOLOv7 prediction with Weights & Biases . See here for an example

python3 demo.py --config-file configs/wearmask/darknet53.yaml --input ./datasets/wearmask/images/val2017 --wandb-entity <your-username/team> --wandb-project <project-name> --opts MODEL.WEIGHTS output/model_0009999.pth

Run SparseInst:

python demo.py --config-file configs/coco/sparseinst/sparse_inst_r50vd_giam_aug.yaml --video-input ~/Movies/Videos/86277963_nb2-1-80.flv -c 0.4 --opts MODEL.WEIGHTS weights/sparse_inst_r50vd_giam_aug_8bc5b3.pth

an update based on detectron2 newly introduced LazyConfig system, run with a LazyConfig model using:

python3 demo_lazyconfig.py --config-file configs/new_baselines/panoptic_fpn_regnetx_0.4g.py --opts train.init_checkpoint=output/model_0004999.pth

😎 Train

For training, quite simple, same as detectron2:

python train_net.py --config-file configs/coco/darknet53.yaml --num-gpus 8

If you want train YOLOX, you can using config file configs/coco/yolox_s.yaml. All support arch are:

  • YOLOX: anchor free yolo;
  • YOLOv7: traditional yolo with some explorations, mainly focus on loss experiments;
  • YOLOv7P: traditional yolo merged with decent arch from YOLOX;
  • YOLOMask: arch do detection and segmentation at the same time (tbd);
  • YOLOInsSeg: instance segmentation based on YOLO detection (tbd);

😎 Rules

There are some rules you must follow to if you want train on your own dataset:

  • Rule No.1: Always set your own anchors on your dataset, using tools/compute_anchors.py, this applys to any other anchor-based detection methods as well (EfficientDet etc.);
  • Rule No.2: Keep a faith on your loss will goes down eventually, if not, dig deeper to find out why (but do not post issues repeated caused I might don't know either.).
  • Rule No.3: No one will tells u but it's real: do not change backbone easily, whole params coupled with your backbone, dont think its simple as you think it should be, also a Deeplearning engineer is not an easy work as you think, the whole knowledge like an ocean, and your knowledge is just a tiny drop of water...
  • Rule No.4: must using pretrain weights for transoformer based backbone, otherwise your loss will bump;

Make sure you have read rules before ask me any questions.

🔨 Export ONNX && TensorRTT && TVM

  1. detr:
python export.py --config-file detr/config/file

this works has been done, inference script included inside tools.

  1. AnchorDETR:

anchorDETR also supported training and exporting to ONNX.

  1. SparseInst: Sparsinst already supported exporting to onnx!!
python export.py --config-file configs/coco/sparseinst/sparse_inst_r50_giam_aug.yaml --video-input ~/Videos/a.flv  --opts MODEL.WEIGHTS weights/sparse_inst_r50_giam_aug_2b7d68.pth INPUT.MIN_SIZE_TEST 512

If you are on a CPU device, please using:

python export.py --config-file configs/coco/sparseinst/sparse_inst_r50_giam_aug.yaml --input images/COCO_val2014_000000002153.jpg --verbose  --opts MODEL.WEIGHTS weights/sparse_inst_r50_giam_aug_2b7d68.pth MODEL.DEVICE 'cpu'

Then you can have weights/sparse_inst_r50_giam_aug_2b7d68_sim.onnx generated, this onnx can be inference using ORT without any unsupported ops.

🤒️ Performance

Here is a dedicated performance compare with other packages.

tbd.

🪜 Some Tiny Object Datasets supported

👋 Detection Results

Image Detections

😯 Dicussion Group

Wechat QQ
image.png image.png
image.png image.png
  • if wechat expired, please contact me update via github issue. group for general discussion, not only for yolov7.
  • QQ群如果满了请加二群:419548605

🀄️ Some Exp Visualizations

GridMask Mosaic

©️ License

Code released under GPL license. Please pull request to this source repo before you make your changes public or commercial usage. All rights reserved by Lucas Jin.

More Repositories

1

tensorflow_poems

中文古诗自动作诗机器人,屌炸天,基于tensorflow1.10 api,正在积极维护升级中,快star,保持更新!
Python
3,595
star
2

weibo_terminater

Final Weibo Crawler Scrap Anything From Weibo, comments, weibo contents, followers, anything. The Terminator
Python
2,303
star
3

alfred

alfred-py: A deep learning utility library for **human**, more detail about the usage of lib to: https://zhuanlan.zhihu.com/p/341446046
Python
854
star
4

DCNv2_latest

DCNv2 supports decent pytorch such as torch 1.5+ (now 1.8+)
C++
564
star
5

keras_frcnn

Keras Implementation of faster-rcnn
Python
521
star
6

thor

thor: C++ helper library, for deep learning purpose
C++
264
star
7

tensorflow_novelist

模仿莎士比亚创作戏剧!屌炸天的是还能创作金庸武侠小说!快star,保持更新!!
Python
259
star
8

weibo_terminator_workflow

Update Version of weibo_terminator, This is Workflow Version aim at Get Job Done!
Python
258
star
9

faceswap_pytorch

Deep fake ready to train on any 2 pair dataset with higher resolution
Python
242
star
10

nb

Neural Network Blocks - Collect all kinds of fancy model blocks for you to build more powerful neural network model.
Python
231
star
11

pytorch_chatbot

A Marvelous ChatBot implement using PyTorch.
Python
226
star
12

CenterNet_Pro_Max

Experiments based on CenterNet (more backbones, TensorRT deployment and mask head)
221
star
13

LSTM_learn

a implement of LSTM using Keras for time series prediction regression problem
Python
214
star
14

AI-Infer-Engine-From-Zero

关于自建AI推理引擎的手册,从0开始你需要知道的所有事情
206
star
15

movenet

Google's Next Gen Pose Estimation in PyTorch
Python
122
star
16

Spider12306

基于Python3的12306抢票爬虫,10个线程开抢,智能过滤凌晨12:00到7:00发车的车次。
Python
106
star
17

pytorch_image_classifier

Minimal But Practical Image Classifier Pipline Using Pytorch, Finetune on ResNet18, Got 99% Accuracy on Own Small Datasets.
Python
106
star
18

kitti-ssd

Train your own data using SSD in a more clear and simple way(not include source code)
Python
101
star
19

TrafficLightsDetection

using SSD and caffe detect traffic lights on LISA dataset
Python
99
star
20

nosmpl

Accelerated SMPL operation, commonly used in generate 3D human mesh, STAR included.
Python
93
star
21

ssds_pytorch

Multiple basenet MobileNet v1,v2, ResNet combined with SSD detection method and it's variants such as RFB, FSSD etc.
Python
80
star
22

simpleocv

Make a minimal OpenCV runable on any where, WIP
C++
72
star
23

yolov3_tf2

Yolov3 implemented with brand new TensorFlow 2.0 API (both train and prediction)
Python
67
star
24

yolov7-face

Next Gen Face detection based on YOLOv7
Python
55
star
25

FruitsNutsSeg

detectron2 support self-define data train
Python
50
star
26

Q-Learning

An C++ Version of Q-Learning, to Train Robot Play with Flappybird!!
C++
40
star
27

cityscapestococo

This repo contains usable code convert cityscapes to coco format (Detectron and maskrcnn-benchmark were all broken)
Python
36
star
28

tfboys

TensorFlow and Pytorch practice codes with purity and simplicity.
Python
34
star
29

OpenHandMocap

Python
33
star
30

textfrontend

单独维护的中文TTS
Python
31
star
31

bboxer

Pure, Simple yet Powerful Image Bound Box Making Tool, already cross platform, welcome star and keep updating.
C++
31
star
32

fpn_rssd

Rotated Box SSD detection Framework with FPN support, next generation object detection framework
Python
29
star
33

aural

A Tiny Project For ASR model training and Deployment
Python
28
star
34

Shadowless

A Fast and Open Source Autonomous Perception System.
C++
27
star
35

awesome_transformer

A curated list of transformer learning materials, shared blogs, technical reviews.
26
star
36

pt_mobilenetv2_deeplabv3

Fast accurate realtime segmentation with DeepLabV3 and MobileNetV2 backbone
Python
26
star
37

pytorch_cycle_gan

CycleGAN with Productive Generate APIs. Generate Any Image from Your Transfer Model.
Python
26
star
38

yolovn

Just another yolo variant.
25
star
39

wanwu_release

Wanwu models release, code will be released soon
23
star
40

spconv

Pytorch layer needed by Second Lidar detector.
C++
23
star
41

3d_detection_kit

Toolkit to Explore 3D data for 3D object detection, point cloud visualization, bev map gen etc. Using KITTI as dummy data
Python
22
star
42

pytorch_image_caption

Image Caption, Show and Tell.
Python
20
star
43

datasets

A Collection of Datasets.
19
star
44

pilgrim_torch2trt

Pilgrim Project: torch2trt, quick convert your pytorch model to TensorRT engine.
C++
19
star
45

yolov5_mask

Try add Instance Segmentation upon YoloV5
Python
18
star
46

libnms

libnms.so for object detection, can be use in libtorch or caffe or nccn or onnx or TensorRT
Cuda
17
star
47

pt_enet

Realtime segmentation with ENet, the fast and accurate segmentation net.
Python
14
star
48

GreatDarkNet

An Edit Version of darknet, and this version you can train and predict on your own datasets! more easily!
C
14
star
49

VIBE_yolov5

Using YOLOv5 as detection on VIBE
Python
13
star
50

daybreak_release

Daybreak APP release
12
star
51

gofind

gofind - your personal find helper
Go
12
star
52

cabinet

Cabinet, The Ultimate Tool Box.
Rust
12
star
53

tensorflow_yolov3

A Detailed and Optimized Implementation of Yolo-V3 in Original TensorFlow.
Python
12
star
54

pytorch_name_net

A NetWork Generate Names, Based On Conditional RNN, Set Condition And Generate Different Names.
Python
11
star
55

tensorflow_extractor

State-of-art and Reliable Text-summary and Information Extraction
Python
11
star
56

RetinaNet

Pytorch Implementation of RetinaNet with CUDA accelerate nms operation.
Python
10
star
57

gluon_ssd

Implement SSD using Gluon in only 300 lines of codes!
Python
10
star
58

m

m editor is a modern, easy to use, fast terminal editor then vim or emacs. written in pure Rust.
Rust
10
star
59

wnnx_models

Various test models in WNNX format. It can view with `pip install wnetron && wnetron`
10
star
60

seg_icnet

ICNet in TensorFlow, Real-Time Segmentation
Python
10
star
61

scraper_toolbox

Python3.6 Scraper Toolbox, You can almost Scrap Anything in this Repo, Welcome Pull Request
Python
9
star
62

fusion

Fusion package with transformation between camera and lidar, IMU etc. Autonomous and robot helper.
Python
9
star
63

blackpearl

The Black Pearl in Golang. Personal Assistant.
Go
9
star
64

mxnet_tiny5

mxnet训练自己的数据集分类,支持模型断点训练和预测单张图片
Python
9
star
65

TTS_CN

A Chinese TTS System!
Python
9
star
66

arxiv_action

企业微信机器人或钉钉机器人定制服务,自动推送arxiv最新paper
Python
9
star
67

tacotron

TensorFlow implementation of Google Tacotron. Train on Audio and Generate Speech using Text. Which can be Called TTS.
Python
8
star
68

papers

Contains many papers with categories in CV, NLP, RL Quantum etc.
8
star
69

pytorch_style_transfer

A Simple Implementation of Neural Style Transfer using Pytorch. You can generate your own art pictures now!
Python
8
star
70

yolov8

7
star
71

numgo

NumPy library in Go.
Go
7
star
72

LLaVA-Magvit2

Python
7
star
73

PoseAILiveLink

PoseAI LiveLink Compatible on macOS
C++
7
star
74

gooooup

Upload load images(files) to cloud, generate permanent link.
Go
7
star
75

mjolnir

Light weighted replacement of original thor C++ library. More simpler, more clean, more light.
C++
7
star
76

UbuntuScripts

Shell
7
star
77

MLLM_Factory

A Dead Simple and Modularized Multi-Modal Training and Finetune Framework. Compatible to any LLaVA/Flamingo/QwenVL/MiniGemini etc series models.
7
star
78

visiontransformers

Vision Transformers that you need.
Python
6
star
79

sherpa_ort

ONNXRuntime ASR C++
C++
6
star
80

minitr

Exploration on Micro Transformers, Unleash the power of mini-transformers!
Python
6
star
81

tensorflow_wgan

A Tensorfow Version of the state-of-art Wasserstein GAN, image super resolution, black image colorful, more function are applying...just star!
Python
6
star
82

tensorflow_classifier

Simple and over-through process for Tensorflow classify images, using own dataset
Python
6
star
83

mxnet_ssd

Another maintained mxnet ssd version
Python
6
star
84

caffe_tiny5

Caffe tutorial for train own data and predict using python
Python
6
star
85

mmc

Next Gen MMD runs on all platforms, Windows, Linux, Mac. Will support exchange between vmd and fbx format.
C++
6
star
86

squeezeseg_pytorch

Realtime Point Cloud Segmentation
Python
6
star
87

vits_cpp

C++ and ONNXRuntime based VITS voice synthesis
C++
6
star
88

tf_pose_realtime

Realtime Openpose with MobileNetV2 backend
PureBasic
6
star
89

realrender

3D mesh render without pain.
C++
6
star
90

mono_odometry

Visual Odometry Using Mono Camera
C++
6
star
91

AwesomeLLM

6
star
92

person_tracking

person tracking in ros
C++
5
star
93

sparrow

The message server in Golang, like WeChat.
JavaScript
5
star
94

algorithm

Contains all kinds of algorithm write in Python and C++, some with Rust.
Python
5
star
95

CaffeHandsOn

This is a Caffe hands on tutorial.
Python
5
star
96

sak

Swiss Army Knife for secret hacking and sniffering
Go
5
star
97

instance_seg_tf

Instance Segmentation with discriminate loss
Python
5
star
98

efficientformers

Collection of efficient transformers.
Python
5
star
99

mumoda

Library to lean big models combined with Text and Image. And then Diffusion!
Python
5
star
100

picbed

Picbed utils for many open APIs
Go
4
star