Official YOLO v7 COMPLETE Object Detection Tutorial | Windows & Linux

แชร์
ฝัง
  • เผยแพร่เมื่อ 31 ม.ค. 2025

ความคิดเห็น • 113

  • @anishantony7687
    @anishantony7687 2 ปีที่แล้ว +7

    successfully run everything but saved images and videos don't have any bounding boxes and confidence.
    can you help me with this?

    • @TheCodingBug
      @TheCodingBug  2 ปีที่แล้ว +1

      You might've missed something. Check pytorch version also. Because it's not possible to have empty bounding boxes from pretrained model.

    • @tanasakchiewchankul9739
      @tanasakchiewchankul9739 2 ปีที่แล้ว

      I have same problem with you. 😢

    • @TheCodingBug
      @TheCodingBug  2 ปีที่แล้ว +2

      @@tanasakchiewchankul9739 use
      --device cpu

    • @wei-yenchen7610
      @wei-yenchen7610 2 ปีที่แล้ว

      I have the same problem .
      My gpu is 1650ti 4G (laptop : G14)
      I don't konw the reason that the result don't have any bounding boxes and confidence.
      TheCodingBug is right.
      Only run on CPU , the problem is solved.
      add those code to the file named "detect.py" ↓↓↓
      torch.cuda.is_available = lambda : False
      device = torch.device('cuda' if torch.cuda.is_available() else 'cpu')

    • @pathfinder8399
      @pathfinder8399 2 ปีที่แล้ว +8

      @@wei-yenchen7610 change the value to; half = False in line 31 of detect.py, it works fine

  • @Wingly113
    @Wingly113 2 ปีที่แล้ว

    straight to the point, thanks for the video!

  • @isrardawar9333
    @isrardawar9333 2 ปีที่แล้ว

    Every step are well explained

  • @shubhamsongire6712
    @shubhamsongire6712 2 ปีที่แล้ว

    Thank you sir it helped me alot to learn latest yolo v7 model

  • @danielleivy8180
    @danielleivy8180 ปีที่แล้ว

    Very well explained 👍🏾

  • @aashishmalhotra
    @aashishmalhotra 2 ปีที่แล้ว +1

    discovered your channel today , and so far content is good. what to expect in future. Will we be doing any projects in yolo?

    • @TheCodingBug
      @TheCodingBug  2 ปีที่แล้ว +1

      Thanks for the appreciation. Yes. I am working on couple of projects with YOLOv7. Stay tuned!!

  • @GuilhermePiresSilvadeAlmeida
    @GuilhermePiresSilvadeAlmeida 2 ปีที่แล้ว +1

    Hello. Congratulations on the video. I couldn't find the images and videos you used in the example. Could you tell me how to get it? Thank you for your attention. Thanks!

    • @TheCodingBug
      @TheCodingBug  2 ปีที่แล้ว

      The link is in the description of the video.

  • @pjhsiao99
    @pjhsiao99 2 ปีที่แล้ว

    Great video.

  • @MdFaiyazAhmedRME
    @MdFaiyazAhmedRME 2 ปีที่แล้ว +1

    Thanks for this video. I have the same problem like others but i want clarify one thing. Do in need to use only pre trained images or i can simply download any image and use it. in my case No bounding box or score

    • @TheCodingBug
      @TheCodingBug  2 ปีที่แล้ว +1

      You can use any image. Try horse image that is included with the repository

    • @MdFaiyazAhmedRME
      @MdFaiyazAhmedRME 2 ปีที่แล้ว

      @@TheCodingBug Thanks for the helps sir.

    • @MdFaiyazAhmedRME
      @MdFaiyazAhmedRME 2 ปีที่แล้ว

      @@TheCodingBug AssertionError: train: No labels in data/train/labels.cache. Can not train without labels.
      can you tell me about this error. i have save all dataset in YOLO format etc.

  • @ShlomoOrna
    @ShlomoOrna ปีที่แล้ว

    Very helpful video. Thank you. Could you add some explanation on how to run YOLOv7 POSE Estimation ? In a response or does it need a separate video ?

  • @VasiliiSilvestrov
    @VasiliiSilvestrov 2 ปีที่แล้ว

    Thank you very mush! Very helpful video! I want to share with the auditory a couple things: firstly: instead of downloading you can you git clone command. It will save lots of time: you won't need to extract and copy files. And secondly, сould you add the used pictures and videos in the description, please.

  • @salahalghyaline3329
    @salahalghyaline3329 ปีที่แล้ว

    Many thanks

  • @fatguyinalittlevive1107
    @fatguyinalittlevive1107 2 ปีที่แล้ว +1

    Thanks for the easy to follow tutorial! Do you have a tutorial for training your own YOLO v7 model?

    • @TheCodingBug
      @TheCodingBug  2 ปีที่แล้ว

      Yes. Following is for training on local machine. You can also find training with colab on my channel.
      th-cam.com/video/-QWxJ0j9EY8/w-d-xo.html

  • @kin_1997
    @kin_1997 2 ปีที่แล้ว

    good content, thank you for sharing.

  • @dwnim
    @dwnim 2 ปีที่แล้ว +1

    thank you for the tutorial, help me alot. i'm newbie in this python environment. i have run the script with webcam and it worked. the problem is, i dont know how to end the webcam process. could you please help me of how to stop the process ? thanks in advance

    • @TheCodingBug
      @TheCodingBug  2 ปีที่แล้ว

      Press q or ESC.
      Otherwise, end script with cntrl+c

  • @miloszivkovic6118
    @miloszivkovic6118 2 ปีที่แล้ว +1

    Very easy and I made it. But my cpu was dying 😂 , i followed evry step and is it possible that yolo is still using my CPU?

  • @xinbert4941
    @xinbert4941 ปีที่แล้ว

    Thanks you help me to install yolov7 and let me know where is the result route

  • @piyushshinde5351
    @piyushshinde5351 2 หลายเดือนก่อน +1

    @ThecodingBug successfully run everything but saved images and videos don't have any bounding boxes and confidence. Help me with this

    • @TheCodingBug
      @TheCodingBug  2 หลายเดือนก่อน

      Set half=False. It should solve the problem... Or use YOLOv11 or Yolov8.

  • @Kishi1969
    @Kishi1969 2 ปีที่แล้ว +1

    Dear Sir, Thanks you , i got a lots of Video from the site you told me and everything worked well with images and videos changing with different weights but im having problem with web cam its given me errors

    • @TheCodingBug
      @TheCodingBug  2 ปีที่แล้ว

      What's the error?

    • @Kishi1969
      @Kishi1969 2 ปีที่แล้ว

      @@TheCodingBug Exception in thread Thread-1:
      Traceback (most recent call last):
      File "C:\Users\MMU\anaconda3\lib\threading.py", line 973, in _bootstrap_inner
      self.run()
      File "C:\Users\MMU\anaconda3\lib\threading.py", line 910, in run
      self._target(*self._args, **self._kwargs)
      File "C:\Users\MMU\Desktop\SA\yolov7\yolov7\utils\datasets.py", line 318, in update
      time.sleep(1 / self.fps) # wait time
      ZeroDivisionError: float division by zero
      C:\Users\MMU\anaconda3\lib\site-packages\torch\functional.py:568: UserWarning: torch.meshgrid: in an upcoming release, it will be required to pass the indexing argument. (Triggered internally at C:\actions-runner\_work\pytorch\pytorch\builder\windows\pytorch\aten\src\ATen
      ative\TensorShape.cpp:2228.)
      return _VF.meshgrid(tensors, **kwargs) # type: ignore[attr-defined]
      Traceback (most recent call last):
      File "C:\Users\MMU\Desktop\SA\yolov7\yolov7\detect.py", line 184, in
      detect()
      File "C:\Users\MMU\Desktop\SA\yolov7\yolov7\detect.py", line 67, in detect
      for path, img, im0s, vid_cap in dataset:
      File "C:\Users\MMU\Desktop\SA\yolov7\yolov7\utils\datasets.py", line 327, in __next__
      if cv2.waitKey(1) == ord('q'): # q to quit
      cv2.error: OpenCV(4.6.0) D:\a\opencv-python\opencv-python\opencv\modules\highgui\src\window.cpp:1333: error: (-2:Unspecified error) The function is not implemented. Rebuild the library with Windows, GTK+ 2.x or Cocoa support. If you are on Ubuntu or Debian, install libgtk2.0-dev and pkg-config, then re-run cmake or configure script in function 'cvWaitKey'

    • @TheCodingBug
      @TheCodingBug  2 ปีที่แล้ว

      @@Kishi1969 It seems opencv installation has some issue. You can reinstall opencv by command: pip install opencv-python==4.5.5.64

    • @Kishi1969
      @Kishi1969 2 ปีที่แล้ว

      @@TheCodingBug I installed the it but same errors and the Webcam , just open instantly and vanished

    • @Kishi1969
      @Kishi1969 2 ปีที่แล้ว

      @@TheCodingBug Errors "
      WARNING: Environment does not support cv2.imshow() or PIL Image.show() image displays
      OpenCV(4.6.0) D:\a\opencv-python\opencv-python\opencv\modules\highgui\src\window.cpp:1267: error: (-2:Unspecified error) The function is not implemented. Rebuild the library with Windows, GTK+ 2.x or Cocoa support. If you are on Ubuntu or Debian, install libgtk2.0-dev and pkg-config, then re-run cmake or configure script in function 'cvShowImage'"

  • @huangyou535
    @huangyou535 11 หลายเดือนก่อน

    Help me a lot!Tks!

  • @verifili
    @verifili 2 ปีที่แล้ว +1

    please can you do end to end toturial about real time objects detection, I mean how implement real time API.

    • @TheCodingBug
      @TheCodingBug  2 ปีที่แล้ว +2

      Hi. If you mean you want to see the results in realtime instead of saving them to hard drive, here is how you can do it.
      python detect.py --weights yolov7.pt --conf 0.25 --img-size 640 --nosave --view-img --source street2.mp4

    • @verifili
      @verifili 2 ปีที่แล้ว +1

      @@TheCodingBug I mean when I build project unsing yolo and wanna push this project in website , so in this case I need to build an API , the question is how we can do this!

    • @TheCodingBug
      @TheCodingBug  2 ปีที่แล้ว +2

      @@verifili Understood. I will by making a video next month.

    • @verifili
      @verifili 2 ปีที่แล้ว

      @@TheCodingBug thnak you 😁😁

  • @andrepascoa8579
    @andrepascoa8579 2 ปีที่แล้ว +1

    Hello im new to ML, where do you train your models in this example?

    • @TheCodingBug
      @TheCodingBug  2 ปีที่แล้ว

      I don't. I use pretrained model. To train a custom model, watch this video th-cam.com/video/-QWxJ0j9EY8/w-d-xo.html

  • @himanthrayagada5453
    @himanthrayagada5453 2 ปีที่แล้ว +1

    @TheCodingBug thank so much for this video
    i take the combination of knifes and guns dataset after training it detects knife as an airplane but i didn't use label called airplane plz could you help me

    • @TheCodingBug
      @TheCodingBug  2 ปีที่แล้ว

      Change labels in text file before training as shown here th-cam.com/video/-QWxJ0j9EY8/w-d-xo.html
      Or just don't load labels from model and redefine them as per your requirements (i. e. replace labels variable with your own)

  • @Kishi1969
    @Kishi1969 2 ปีที่แล้ว

    Mind blowing and very educative. Where do you get your video? 🙏

    • @TheCodingBug
      @TheCodingBug  2 ปีที่แล้ว

      It's good to hear that you found it helpful. The videos are from royalty free websites.

    • @Kishi1969
      @Kishi1969 2 ปีที่แล้ว

      @@TheCodingBug Thanks, i will look for video of such 🙏

  • @avr4dev
    @avr4dev 2 ปีที่แล้ว +1

    Why do you set up pytorch separately? It is in requirements.txt (on your video as well)

    • @TheCodingBug
      @TheCodingBug  2 ปีที่แล้ว

      That's without cuda support. That's why I install it separately with cuda.

  • @brunospfc8511
    @brunospfc8511 2 ปีที่แล้ว +1

    Great video, this channel helped me with easy instructions :D, would you do it on custom dataset? thanks

    • @TheCodingBug
      @TheCodingBug  2 ปีที่แล้ว +1

      I am glad you found it helpful. Yes I will be uploading a tutorial on training yolo v7 on custom dataset next week.

    • @Kishi1969
      @Kishi1969 2 ปีที่แล้ว

      @@TheCodingBug please kindly do on a custom dataset that would be great, i tried but having problems about where to place my. Yaml file 🙏🙏🙏

    • @MEATHEADBooYA
      @MEATHEADBooYA 2 ปีที่แล้ว

      @@TheCodingBug I am interested on where the weights go now with Yolo V7. A custom dataset tutorial will be great!

  • @ucduyvo4552
    @ucduyvo4552 2 ปีที่แล้ว

    Thank you so much, but I have problem with the time when running the stream rtsp link, it just maintains a short time, about 3-5 minutes and then no signal, show black screen, how can I solve this problem to increase the time streaming, maintain about 1 day, 1 month,...

  • @annwang5530
    @annwang5530 2 ปีที่แล้ว +1

    Question: could I train with YOLO in Jetson NX to create a model for inference in Raspberry pi? (Sorry I'm newbie)

    • @TheCodingBug
      @TheCodingBug  2 ปีที่แล้ว +1

      Yes you can do it. Just convert the model to onnx.

    • @annwang5530
      @annwang5530 2 ปีที่แล้ว

      @@TheCodingBug thanks, probably I will be using online Google service instead of Jetson

  • @tokamohsen6696
    @tokamohsen6696 2 ปีที่แล้ว

    I tried to run it on many images but the run folder gets empty folders and no images produced

  • @msirac9405
    @msirac9405 2 ปีที่แล้ว +1

    CUDA initialization: CUDA driver initialization failed, you might not have a CUDA gpu.
    I got this error how can i fix it

    • @TheCodingBug
      @TheCodingBug  2 ปีที่แล้ว +1

      If you have nvidia GPU, update the drivers.

    • @msirac9405
      @msirac9405 2 ปีที่แล้ว +2

      @@TheCodingBug thanks for helping i like your contents keep going

    • @msirac9405
      @msirac9405 2 ปีที่แล้ว

      @@alihan1287 OMG yes how did u find me?

  • @naveenpaliwal3884
    @naveenpaliwal3884 ปีที่แล้ว

    Thanks for the video ! It helps a lot. How we can convert entire project in exe file

  • @serious-rc933
    @serious-rc933 2 ปีที่แล้ว

    I get PackagesNotFoundError: The following packages are not available from current channels:
    - pyhton=3.9

  • @punityadav4672
    @punityadav4672 2 ปีที่แล้ว +1

    how get distance of specific object

    • @TheCodingBug
      @TheCodingBug  2 ปีที่แล้ว +1

      Will upload specific tutorial for that.

    • @punityadav4672
      @punityadav4672 2 ปีที่แล้ว

      Please upload as soon as possible

  • @RSF02
    @RSF02 2 ปีที่แล้ว

    Thanks for the useful tutorial. But it cant run and giving me this error FileNotFoundError: [WinError 2] The system cannot find the file specified: 'runs\\detect\\exp2'
    can you help mee ?

  • @jeronimoalester4338
    @jeronimoalester4338 2 ปีที่แล้ว

    Good afternoon. I was wondering if it's possible to get the coordinates of bounding boxes from yolo v 7 test/detection?

  • @opensourcethings
    @opensourcethings 11 หลายเดือนก่อน

    I want .cfg file and .weights file so that i use it in my python open cv code. is it possible ??

  • @krisnarengga
    @krisnarengga 2 ปีที่แล้ว +1

    is there any C or C++ implementation for YoloV7 ?

    • @TheCodingBug
      @TheCodingBug  2 ปีที่แล้ว +1

      I am not sure. But I'll be making darknet based tutorial for YOLOv7 in future.

  • @hindi_recap1
    @hindi_recap1 2 ปีที่แล้ว +1

    How can we do instance segmentation using yolov7

    • @TheCodingBug
      @TheCodingBug  2 ปีที่แล้ว +2

      th-cam.com/video/tq0GI4FahWU/w-d-xo.html

    • @hindi_recap1
      @hindi_recap1 2 ปีที่แล้ว

      @@TheCodingBug thanks 👍

  • @code786yt2
    @code786yt2 ปีที่แล้ว

    how to run real time object detection to scan my desktop.

  • @hocklintai3391
    @hocklintai3391 2 ปีที่แล้ว

    I tried using the camera to detect object real time, but it ended up with AttributeError: 'NoneType' object has no attribute 'Shape'. Any ideas how to fix that?

    • @TheCodingBug
      @TheCodingBug  2 ปีที่แล้ว

      The script is unable to detect your webcam. Maybe you're giving wrong webcam number.

  • @abrarluvrabit
    @abrarluvrabit 2 ปีที่แล้ว

    Hello Sir thanks for the awesome video, from where i can get this street2.mp4 video file?

  • @im_insaf
    @im_insaf 2 ปีที่แล้ว +1

    Does it work for mac m1?

    • @TheCodingBug
      @TheCodingBug  2 ปีที่แล้ว

      Yes if you install Anaconda for Mac.

  • @satyamohanty-be7vo
    @satyamohanty-be7vo 2 ปีที่แล้ว +1

    how to run it on webcam?

    • @TheCodingBug
      @TheCodingBug  2 ปีที่แล้ว

      Use 0 for --source instead of video.

  • @nawthazin9327
    @nawthazin9327 2 ปีที่แล้ว

    Could I run this code in raspberry pi4?

    • @TheCodingBug
      @TheCodingBug  2 ปีที่แล้ว

      Yes. But use tiny version.

  • @neil7356
    @neil7356 2 ปีที่แล้ว

    I get the error:
    detect.py: error: unrecognized arguments: --source 0 😥

  • @emanuel22223
    @emanuel22223 2 ปีที่แล้ว

    Can YOLOV7 be used with Darknet?

  • @TejashKatuwal
    @TejashKatuwal 2 ปีที่แล้ว

    qt.qpa.xcb: could not connect to display
    qt.qpa.plugin: Could not load the Qt platform plugin "xcb" in "/usr/local/lib/python3.8/dist-packages/cv2/qt/plugins" even though it was found.
    This application failed to start because no Qt platform plugin could be initialized. Reinstalling the application may fix this problem.
    Available platform plugins are: xcb.
    webcam is not working on colab

  • @weavy2468
    @weavy2468 2 ปีที่แล้ว

    is it detected?

  • @ptginnovators5688
    @ptginnovators5688 2 ปีที่แล้ว

    Exception in thread Thread-1:
    Traceback (most recent call last):
    File "C:\Users\MMU\anaconda3\lib\threading.py", line 973, in _bootstrap_inner
    self.run()
    File "C:\Users\MMU\anaconda3\lib\threading.py", line 910, in run
    self._target(*self._args, **self._kwargs)
    File "C:\Users\MMU\Desktop\SA\yolov7\yolov7\utils\datasets.py", line 318, in update
    time.sleep(1 / self.fps) # wait time
    ZeroDivisionError: float division by zero
    C:\Users\MMU\anaconda3\lib\site-packages\torch\functional.py:568: UserWarning: torch.meshgrid: in an upcoming release, it will be required to pass the indexing argument. (Triggered internally at C:\actions-runner\_work\pytorch\pytorch\builder\windows\pytorch\aten\src\ATen
    ative\TensorShape.cpp:2228.)
    return _VF.meshgrid(tensors, **kwargs) # type: ignore[attr-defined]
    Traceback (most recent call last):
    File "C:\Users\MMU\Desktop\SA\yolov7\yolov7\detect.py", line 184, in
    detect()
    File "C:\Users\MMU\Desktop\SA\yolov7\yolov7\detect.py", line 67, in detect
    for path, img, im0s, vid_cap in dataset:
    File "C:\Users\MMU\Desktop\SA\yolov7\yolov7\utils\datasets.py", line 327, in _next_
    if cv2.waitKey(1) == ord('q'): # q to quit
    cv2.error: OpenCV(4.6.0) D:\a\opencv-python\opencv-python\opencv\modules\highgui\src\window.cpp:1333: error: (-2:Unspecified error) The function is not implemented. Rebuild the library with Windows, GTK+ 2.x or Cocoa support. If you are on Ubuntu or Debian, install libgtk2.0-dev and pkg-config, then re-run cmake or configure script in function 'cvWaitKey'
    @TheCodingBug- Hey , thank you so much for this nice tutorial,plz help me in the above mentioned error.
    Note-I have already installed the opencv version that you have suggested.

  • @shahadathossain3468
    @shahadathossain3468 11 หลายเดือนก่อน

    detect.py", line 117, in detect
    s += '%g %ss, ' % (n, names[int(c)]) # add to string
    ~~~~~^^^^^^^^
    IndexError: list index out of range

  • @vijayalakshmisomu5419
    @vijayalakshmisomu5419 2 ปีที่แล้ว

    Hi I am trying to test the custom data on pretrained weights by chainging the test path in coco.yaml but its not working

  • @rizvee3977
    @rizvee3977 ปีที่แล้ว +1

    Traceback (most recent call last):
    File "C:\Users\User\yolov7\utils\google_utils.py", line 26, in attempt_download
    assets = [x['name'] for x in response['assets']] # release assets
    KeyError: 'assets'
    During handling of the above exception, another exception occurred:
    Traceback (most recent call last):
    File "detect.py", line 196, in
    detect()
    File "detect.py", line 34, in detect
    model = attempt_load(weights, map_location=device) # load FP32 model
    File "C:\Users\User\yolov7\models\experimental.py", line 251, in attempt_load
    attempt_download(w)
    File "C:\Users\User\yolov7\utils\google_utils.py", line 31, in attempt_download
    tag = subprocess.check_output('git tag', shell=True).decode().split()[-1]
    IndexError: list index out of range
    I am getting this error. What should I do?

    • @TheCodingBug
      @TheCodingBug  ปีที่แล้ว +1

      You didn't download the yolov7 weights file and placed alongside the code. If you have, make sure your spellings for the file name is correct for --weights parameter.

  • @bravinraamnaidu2905
    @bravinraamnaidu2905 2 ปีที่แล้ว

    Namespace(weights=['yolov7.pt'], source='street2.mp4', img_size=640, conf_thres=0.4, iou_thres=0.45, device='', view_img=True, save_txt=False, save_conf=False, nosave=True, classes=None, agnostic_nms=False, augment=False, update=False, project='runs/detect', name='exp', exist_ok=False, no_trace=False)
    YOLOR 2023-1-2 torch 1.10.0 CUDA:0 (NVIDIA GeForce 940MX, 2047.875MB)
    'git' is not recognized as an internal or external command,
    operable program or batch file.
    Traceback (most recent call last):
    File "C:\FYP\YOLOV7\utils\google_utils.py", line 26, in attempt_download
    assets = [x['name'] for x in response['assets']] # release assets
    KeyError: 'assets'
    During handling of the above exception, another exception occurred:
    Traceback (most recent call last):
    File "C:\FYP\YOLOV7\detect.py", line 196, in
    detect()
    File "C:\FYP\YOLOV7\detect.py", line 34, in detect
    model = attempt_load(weights, map_location=device) # load FP32 model
    File "C:\FYP\YOLOV7\models\experimental.py", line 251, in attempt_load
    attempt_download(w)
    File "C:\FYP\YOLOV7\utils\google_utils.py", line 31, in attempt_download
    tag = subprocess.check_output('git tag', shell=True).decode().split()[-1]
    File "C:\Users\ACER\anaconda3\envs\yolov7\lib\subprocess.py", line 424, in check_output
    return run(*popenargs, stdout=PIPE, timeout=timeout, check=True,
    File "C:\Users\ACER\anaconda3\envs\yolov7\lib\subprocess.py", line 528, in run
    raise CalledProcessError(retcode, process.args,
    subprocess.CalledProcessError: Command 'git tag' returned non-zero exit status 1.
    so why i got error

    • @reyvincentlazarte4506
      @reyvincentlazarte4506 11 หลายเดือนก่อน

      we have the same problem asking if you solve the problem

  • @KUMARIPRIYANKA-f1f
    @KUMARIPRIYANKA-f1f ปีที่แล้ว

    how to calculate precision and recall in this project