Coder Social home page Coder Social logo

wongkinyiu / yolov7 Goto Github PK

View Code? Open in Web Editor NEW
12.7K 12.7K 4.0K 74.24 MB

Implementation of paper - YOLOv7: Trainable bag-of-freebies sets new state-of-the-art for real-time object detectors

License: GNU General Public License v3.0

Python 1.18% Shell 0.01% Dockerfile 0.01% Jupyter Notebook 98.81%
darknet pytorch scaled-yolov4 yolor yolov3 yolov4 yolov7

yolov7's People

Contributors

ak391 avatar akashad98 avatar alexeyab avatar alexeysi avatar dhiaeddine-oussayed avatar dmlon avatar greatv avatar hran2004 avatar hungtrieu07 avatar ian321 avatar jpkoponen avatar kadirnar avatar kayce001 avatar kivanctezoren avatar ksnzh avatar linaom1214 avatar linghu8812 avatar m-gangloff avatar mkhoshbin72 avatar philipp-schmidt avatar raymondben avatar rohanpatankar926 avatar samsamhuns avatar sashaalderson avatar spacewalk01 avatar superfast852 avatar taka-wang avatar triple-mu avatar wongkinyiu avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

yolov7's Issues

Classification label

t[range(n), tcls[i]] = self.cp
#t[t==self.cp] = iou.detach().clamp(0).type(t.dtype)

Hello, I'm glad to see the release of yolov7. Using self.cp instead of using IOU value as classification label, is it because it will lead to performance degradation in your experiment?

SOTA claims vs leaderboards mismalignment

@WongKinYiu @AlexeyAB
Hi friendly pings

YOLOv7 surpasses all known object detectors in both speed and accuracy in the range from 5 FPS to 160 FPS and has the highest accuracy 56.8% AP among all known real-time object detectors with 30 FPS or higher on GPU V100.

Weird claim when you actually rank #20 on COCO
If we exclude all models with extra training data you still rank #11.
the #1 without extra data is Dual-Swin-L(HTC, multi-scale), with 60.1 box AP
with extra data it is DINO(Swim-L,multi-scale) with 63.3 box AP

Yolov7-tiny version in yaml

Hi,

Is there available the .yaml version of the yolov7-tiny.cfg?

I'd like to train it with my custom data using PyTorch. Already tested with darknet and is working fine

attempt_download ERROR

assets = [x['name'] for x in response['assets']] # release assets
KeyError: 'assets'

\utils\google_utils.py", line 26, in attempt_download

Dataset cache incompatible with YOLOv5 cache

As usual, when starting a new training, YOLOv7 will try to spawn train.cache/valid.cache.
This is the same name as YOLOv5 cache which, if already exists, will crash the training.

For present and future compatibility, could it be something with some sort of identifier? Example: "train.yolov7", "train.cachev7", etc.
Just a reminder that, for YOLOR, it's "train.cache3".

error on train

I try to train on my dataset (good worked on yolov5) and got error after several steps:

     Epoch   gpu_mem       box       obj       cls     total    labels  img_size
       0/4     1.41G   0.04262     2.882         0     2.925         1       640:   7%| | 3/41 [00:06<01:25,  2.24s/i
Traceback (most recent call last):
  File "./train.py", line 609, in <module>
    train(hyp, opt, device, tb_writer)
  File "./train.py", line 362, in train
    loss, loss_items = compute_loss_ota(pred, targets.to(device), imgs)  # loss scaled by batch_size
  File "/mnt/HD0/projects/yolov7/yolov7/utils/loss.py", line 585, in __call__
    bs, as_, gjs, gis, targets, anchors = self.build_targets(p, targets, imgs)
  File "/mnt/HD0/projects/yolov7/yolov7/utils/loss.py", line 778, in build_targets
    matching_bs[i] = torch.cat(matching_bs[i], dim=0)
NotImplementedError: There were no tensor arguments to this function (e.g., you passed an empty list of Tensors), but no fallback function is registered for schema aten::_cat.  This usually means that this function requires a non-empty list of Tensors, or that you (the operator writer) forgot to register a fallback function.  Available functions are [CPU, CUDA, QuantizedCPU, BackendSelect, Python, Named, Conjugate, Negative, ZeroTensor, ADInplaceOrView, AutogradOther, AutogradCPU, AutogradCUDA, AutogradXLA, AutogradLazy, AutogradXPU, AutogradMLC, AutogradHPU, AutogradNestedTensor, AutogradPrivateUse1, AutogradPrivateUse2, AutogradPrivateUse3, Tracer, AutocastCPU, Autocast, Batched, VmapMode, Functionalize].

How I can fix this?
Tried on GPU and CPU.
For CPU I had to fix some code at 71 line of train.py:

run_id = torch.load(weights, map_location=device).get('wandb_id') if weights.endswith('.pt') and os.path.isfile(weights) else None

parameter ", map_location=device" was added.

Train custom dataset

Hi,

Is the repo ready for training on custom dataset?

I am trying to find implementation of Coarse-to-fine lead head guided label assigner in the repo and can anyone point out where is this portion located?

Does it run on coral TPU

What model can be runned in Google Coral TPU Accelerator?
Is it there a snip code to transform into model_quantized.tflite?

CUDA out of memory on Colab

I am running inference on a video in google colab, and after processing some frames, I am getting CUDA out of memory. @WongKinYiu
Anyways, thanks for the great work

redundant code

Thanks for the great work. I saw so many codes that look like YOLOV5, the author is still cleaning?

About the architecture

Hi, I tried to plot the yolov7 backbone block.
Could you help me to check the figure is correct or not?

Thanks, a lot.

YOLOv7-Tiny
yolov7_tiny

YOLOv7
yolov7

YOLOv7-d6
yolov7_d6

YOLOv7-e6
yolov7_e6

YOLOv7-e6e
yolov7_e6e

onnx->tensorrt

when onnx_to_tensorrt
In node 163 (parseGraph): INVALID_GRAPH: Assertion failed: ctx->tensors().count(inputName)

onnx is from models/export.py.
my testing model is pretrained yolov7.pt

The speed of the tiny model.

Hi,
I tested the tiny model on a CPU, it turned on approximately 350ms per image, at the same time, I tested the nano version of YOLOv5 on the same CPU and it was two times faster than YOLOv7-tiny. However, in the paper, it's specified that YOLOv7-tiny is approximately two times faster than YOLOv5-N when executed on a GPU. Is that normal?
Many thanks!

Setup or installation instructions

Hi, I am wondering if there will be some notes regarding the setup or installation of the official YOLOv7, preferrably for installation with Docker? Would be great if some material related to this can be added to the repo.

Issue using the webcam

Hi @WongKinYiu - Excited to try the implementation !
I can't use the webcam, actually the function LoadWebcam is not called at the detect file, only LoadStreams is called.
One more thing, could your provide please the tiny-pretrained model?
Thank you so much!

REORG operation may not be needed

REORG operation may not be needed, as it has been demonstrated in the V 5 work, with better efficiency through a Conv[64, 6, 2, 2]]

wow

When will the training be released

Thank you for this!! I dub this the official YOLOv7

I really appreciate your guys contribution! It is backed by an official Peer reviewed paper - It also has reputable authors. I wish we could have an official board to regulate YOLO models. Looking forward to making a course on this model!

1

RuntimeError: There were no tensor arguments to this function (e.g., you passed an empty list of Tensors), but no fallback function is registered for schema aten::_cat. This usually means that this function requires a non-empty list of Tensors. Available functions are [CPU, CUDA, QuantizedCPU, BackendSelect, Named, AutogradOther, AutogradCPU, AutogradCUDA, AutogradXLA, AutogradNestedTensor, UNKNOWN_TENSOR_TYPE_ID, AutogradPrivateUse1, AutogradPrivateUse2, AutogradPrivateUse3, Tracer, Autocast, Batched, VmapMode].
image

TRT errors on concatentation route_15

Total weights read: 37669889
Building YOLO network

      layer                        input               output         weightPtr
(0)   conv_silu                  3 x 640 x 640      32 x 640 x 640    992    
(1)   conv_silu                 32 x 640 x 640      64 x 320 x 320    19680  
(2)   conv_silu                 64 x 320 x 320      64 x 320 x 320    56800  
(3)   conv_silu                 64 x 320 x 320     128 x 160 x 160    131040 
(4)   conv_silu                128 x 160 x 160      64 x 160 x 160    139488 
(5)   conv_silu                 64 x 160 x 160      64 x 160 x 160    143840 
(6)   conv_silu                 64 x 160 x 160      64 x 160 x 160    180960 
(7)   conv_silu                 64 x 160 x 160      64 x 160 x 160    218080 
(8)   conv_silu                 64 x 160 x 160      64 x 160 x 160    255200 
(9)   conv_silu                 64 x 160 x 160      64 x 160 x 160    292320 
(10)  route                           -            128 x 160 x 160    292320 
(11)  conv_silu                128 x 160 x 160     256 x 160 x 160    326112 
(12)  conv_silu                256 x 160 x 160     128 x 160 x 160    359392 
(13)  conv_silu                128 x 160 x 160     128 x 160 x 160    376288 
(14)  conv_silu                128 x 160 x 160     128 x  80 x  80    524256 
ERROR: [TRT]: 4: [layers.cpp::estimateOutputDims::1944] Error Code 4: Internal Error (route_15: all concat input tensors must have the same dimensions except on the concatenation axis (0), but dimensions mismatched at index 1. Input 0 shape: [128,80,80], Input 1 shape: [128,160,160])

I tried my hand at generating darknet weights for yolov7.pt but I am blocked getting it converted to TensorRT. Any guidance on this issue?

Distributed training(DDP)

why write here parser.add_argument('--local_rank', type=int, default=-1, help='DDP parameter, do not modify'),if i want to use DDP, should i change to 0

good job !!!

I want to ask why P is always much lower than R during training?
Are these two values weighted during training?

matching_bs[i] = torch.cat(matching_bs[i], dim=0)

File "/root/yolov7-main/utils/loss.py", line 778, in build_targets
matching_bs[i] = torch.cat(matching_bs[i], dim=0)
NotImplementedError: There were no tensor arguments to this function (e.g., you passed an empty list of Tensors), but no fallback function is registered for schema aten::_cat. This usually means that this function requires a non-empty list of Tensors, or that you (the operator writer) forgot to register a fallback function. Available functions are [CPU, CUDA, QuantizedCPU, BackendSelect, Named, ADInplaceOrView, AutogradOther, AutogradCPU, AutogradCUDA, AutogradXLA, UNKNOWN_TENSOR_TYPE_ID, AutogradMLC, AutogradHPU, AutogradNestedTensor, AutogradPrivateUse1, AutogradPrivateUse2, AutogradPrivateUse3, Tracer, Autocast, Batched, VmapMode].

More loss function information

Can you provide additional information about the complete composite loss function formula? The paper does not provide enough information.

Please provide a full set of 640 scale training models, and don't do curve comparison.

Please provide a full set of 640 scale training models, and don't do curve comparison.
There are many unfair comparisons in your form, which will not show you to be superior, but will only mislead readers and make readers more confused.
請提供全套640尺度的訓練模型,不要做曲線對比。
你的表格存在很多不公平的對比,這並不會顯得你很優越,只會誤導讀者,讓讀者更困惑。

what is the INPUT_BLOB_NAME and OUTPUT_BLOB_NAME, when trensorrt forward?

yolov5 is:
const char* INPUT_BLOB_NAME = "data";
const char* OUTPUT_BLOB_NAME = "prob";

yolov6 is:
const char* INPUT_BLOB_NAME = "image_arrays";
const char* OUTPUT_BLOB_NAME = "outputs";

yolov7 input is images and output is putput
const char* INPUT_BLOB_NAME = "images";
const char* OUTPUT_BLOB_NAME = "output";

yolov7, use the above, all is -1, as below:
IRuntime* runtime = createInferRuntime(gLogger);
assert(runtime != nullptr);
ICudaEngine* engine = runtime->deserializeCudaEngine(trtModelStream, size);
assert(engine != nullptr);
IExecutionContext* context = engine->createExecutionContext();
assert(context != nullptr);
delete[] trtModelStream;
const ICudaEngine& engine = context.getEngine();
const int inputIndex = engine.getBindingIndex(INPUT_BLOB_NAME); //return -1
const int outputIndex = engine.getBindingIndex(OUTPUT_BLOB_NAME); //return -1

About yolov7 Model's Configuration?

Firstly, It's a great work derived from YOLO series, but I notice that the 'cfg' fold in your repo have a 'deploy' direction with various v7's model configuration files, are they the model's cfg after re-parameterization and different from training models?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.