Object Detection Using YOLOv7 and Flask | Object Detection Web Application

Поділитися
Вставка
  • Опубліковано 13 лют 2023
  • Learn to Create AI Based Personal Protective Equipment Detection System for construction Site using YOLOv7 and Flask.
    GitHub code: github.com/AarohiSingla/Objec...
    For queries: You can comment in comment section or you can mail me at aarohisingla1987@gmail.com
    An AI based inspection system can reliably identify complex situations in real-time and clearly identify previously trained features (e.g. safety helmets & vests) - even under difficult viewing angles, light situations, weather conditions.
    In computer vision, real-time object detection is a very important task that is often a key component in computer vision systems.
    An object detector is an object detection algorithm that performs image recognition tasks by taking an image as input and then predicting bounding boxes and class probabilities for each object in the image. Most algorithms use a convolutional neural network (CNN) to extract features from the image to predict the probability of learned classes.
    What is YOLO in computer vision?
    YOLO stands for “You Only Look Once”, it is a popular family of real-time object detection algorithms. The original YOLO object detector was first released in 2016. It was created by Joseph Redmon, Ali Farhadi, and Santosh Divvala. At release, this architecture was much faster than other object detectors and became state-of-the-art for real-time computer vision applications. Since then, different versions and variants of YOLO have been proposed, each providing a significant increase in performance and efficiency. The versions from YOLOv1 to the popular YOLOv3 were created by then-graduate student Joseph Redmon and advisor Ali Farhadi. YOLOv4 was introduced by Alexey Bochkovskiy, who continued the legacy since Redmon had stopped his computer vision research due to ethical concerns. YOLOv7 is the latest official YOLO version created by the original authors of the YOLO architecture. We expect that many commercial networks will move directly from YOLOv4 to v7, bypassing all the other numbers.
    #objectdetection #python #flask #webapplicationdevelopment #webapp
  • Наука та технологія

КОМЕНТАРІ • 141

  • @soravsingla8782
    @soravsingla8782 Рік тому +1

    The best video channel to learn new things.. Thank you for sharing🙏🙏

  • @kbadruddin2695
    @kbadruddin2695 Рік тому

    what is the minimum system requirements to use yolo v7?

  • @kanikabisht6331
    @kanikabisht6331 Рік тому +1

    It's an awesome learning.. Thank you mam, #codeWithAarohi

  • @samehhussien3412
    @samehhussien3412 Рік тому

    when i use this code doing 2 post and 2 get . when choose image ?

  • @jhonnatancorrea5211
    @jhonnatancorrea5211 Рік тому

    Thank you for sharing your knowledge!!

  • @salmabif
    @salmabif 8 місяців тому

    can you guide about yolo8 for detection and counting objects in images.

  • @cyberhard
    @cyberhard Рік тому +1

    As usual, a superb presentation.

  • @user-nf3gs4vz3k
    @user-nf3gs4vz3k 11 місяців тому +1

    Hello, after watching your video, I am learning django, and now I want to learn the deployment of deep learning, please can send the complete code, thanks

  • @Sunil-ez1hx
    @Sunil-ez1hx Рік тому

    Thats an amazing video👍👍

  • @arnavthakur5409
    @arnavthakur5409 Рік тому

    Very nice tutorial ma'am. Thank you so much

  • @abdulhakeem-ec4jy
    @abdulhakeem-ec4jy Рік тому +1

    can you show me how to run this using google collab?

  • @Ak-um1yg
    @Ak-um1yg Рік тому +1

    Thanks can you please explain how to deploy ML Model with Flask frontend hosted for free

  • @hamidullahturkmen1782
    @hamidullahturkmen1782 Рік тому

    Thank you so much, Nice tutorial Dear Aarohi.

  • @kbadruddin2695
    @kbadruddin2695 Рік тому

    does yolo algorithm need graphics card pc's? or a particular versions of yolo need GC?

    • @CodeWithAarohi
      @CodeWithAarohi  Рік тому +1

      NO, You can also work using CPU. Use the command like this python detect.py --source --weights --device cpu

    • @kbadruddin2695
      @kbadruddin2695 Рік тому

      @@CodeWithAarohi thank you ma'am

  • @user-fo8ub1nt5c
    @user-fo8ub1nt5c 11 місяців тому

    I want to use multiple different yolo models on my web page, such as v5 v6 v7, is there any good way?

    • @CodeWithAarohi
      @CodeWithAarohi  11 місяців тому

      You can write a function where you can call all those models.

  • @body1024
    @body1024 Рік тому

    amazing video
    i have a question
    i have trained a model using detectron2 and i need to use that model to annotate a new images to add them to my train dataset, so is there any way i can do it please ?

    • @CodeWithAarohi
      @CodeWithAarohi  Рік тому +1

      Yes, you can use your trained model to annotate new images using Detectron2.
      Load the trained model: You can use the detectron2.modeling.build_model function to build a new instance of the model and load the trained weights.
      Prepare the new images: You will need to load the new images you want to annotate and convert them into the format expected by Detectron2. This typically involves resizing the images and converting them to the BGR format.
      Run inference on the new images: Use the model object to perform inference on the new images. The model object takes as input a list of images and outputs the predicted object instances for each image.
      Visualize the annotations: You can use the visualizer object to visualize the annotations on the images. The visualizer takes as input the image and the predicted object instances and outputs the annotated image.
      Save the annotations: Finally, you can save the annotations to a format that can be used to update your train dataset. This could be a COCO-style JSON file or any other format that is compatible with your training pipeline.

    • @body1024
      @body1024 Рік тому

      @@CodeWithAarohi thank you so much

  • @anilvashisth16
    @anilvashisth16 Рік тому

    Good work Aarohi..carry on ..

  • @spider_fer
    @spider_fer Рік тому

    Hello! First thanks so much for this video, I'm having trouble launching the web cam feature, seems like the code in the repo is diferent. I've tried multiple ways to run the web cam but i l keep getting error 500. Any advice or article to help me solve this?

    • @CodeWithAarohi
      @CodeWithAarohi  Рік тому

      Mail me, I will send you the solution there aarohisingla1987@gmail.com

  • @GlenBennetHermon
    @GlenBennetHermon 7 місяців тому

    Hi Aarohi! is there a way to get the class names by hovering over the bounding boxes or by clicking them, rather than displaying all the class names? Because with all the names of the classes the resulting image is really messy.

    • @CodeWithAarohi
      @CodeWithAarohi  7 місяців тому

      Yes, you can do that. After performing Object detection on the uploaded image, Send the detected objects to the frontend using AJAX or any other suitable method. Then Implement JAvascript event handlers for hover or click event. When a user hovers over or clicks on a bounding box, trigger an event. When the hover or click event is triggered, use the corresponding bounding box's class label to dynamically display the class name

  • @ranchi6798
    @ranchi6798 5 місяців тому

    This is just what I was looking for.
    I have a one request, can I get the codes you used in this video please? Because the ones in your repo seem to be a little different. I want to create a similar web app to inference my yolo model on

    • @CodeWithAarohi
      @CodeWithAarohi  5 місяців тому

      This code is available for channel members ( Contribution level 2).

  • @harsh7704
    @harsh7704 5 місяців тому

    Hello, do we need test data folder path inside data.yaml file? as in most of the versions - I have not seen it. Also in your v8 and v5 video - this test path inside data.yaml file is not present ?

    • @CodeWithAarohi
      @CodeWithAarohi  5 місяців тому

      Yes, you can skip the test path in yaml file.

    • @harsh7704
      @harsh7704 4 місяці тому

      @@CodeWithAarohi Hi, in flask file - predict_img.imgpath = f.filename - shows attribute error every time. Could you assist as it is not defined in the code with function predict_img

  • @godisgreat3892
    @godisgreat3892 5 місяців тому

    thank you for this video.

  • @pvrohanraj
    @pvrohanraj Рік тому

    it seems the github code layout has been updated heavily, i was going to add webcam object detection with yolov7? the image and the video works fine. But this one gives Path and Detection issues

    • @CodeWithAarohi
      @CodeWithAarohi  Рік тому

      Yes, The design I have provided is the base design and you can work on that from index.html file and css

  • @NisitSirimarnkit
    @NisitSirimarnkit Рік тому

    yolov8 and yolov7, What's the best?

    • @CodeWithAarohi
      @CodeWithAarohi  Рік тому

      There is no straightforward answer to which is the best between YOLOv7 and YOLOv8, as both are state-of-the-art object detection models that have their strengths and weaknesses.
      YOLOv7 is not an official version of YOLO, but rather a community-driven implementation based on YOLOv5. It introduces several improvements over YOLOv5, such as better backbone networks, more advanced data augmentation techniques.
      On the other hand, YOLOv8 is the latest official version of the YOLO series, and it introduces several improvements over YOLOv7. YOLOv8 uses a new backbone network, CSPDarknet53, which is faster and more accurate than the Darknet53 backbone used in YOLOv7. YOLOv8 also introduces a new architecture called Path Aggregation Network (PANet), which improves the model's ability to detect objects at different scales.
      both YOLOv7 and YOLOv8 are advanced object detection models with their unique features and benefits. The choice of which model to use will depend on various factors, such as the specific application requirements, available computational resources, and desired accuracy and speed trade-offs.

  • @ariouathanane
    @ariouathanane Рік тому +1

    Hello,
    Thanks for your video. i'm trying to run the code but i have this error
    filename = predict_img.imgpath
    AttributeError: 'function' object has no attribute 'imgpath'

    • @CodeWithAarohi
      @CodeWithAarohi  Рік тому

      predict_img is a function and imgpath is a variable declared inside that function. This variable is storing the filepath on which we want to perform detection. If you are getting error then you can use some other way to get the path of the file(image).

  • @muhammadsabrimas2016
    @muhammadsabrimas2016 Рік тому

    do you have any source of solar panel defect dataset??

  • @anikaafrin3351
    @anikaafrin3351 Рік тому

    Can you send me your one kindly? again there is showing an error no attribute called imgpath in predict_img... why is it showing?

    • @CodeWithAarohi
      @CodeWithAarohi  Рік тому

      predict_img is a function and imgpath is a variable declared inside that function. This variable is storing the filepath on which we want to perform detection. If you are getting error then you can use some other way to get the path of the file(image).

  • @andrewpkiror1982
    @andrewpkiror1982 7 місяців тому

    Your videos are always amazing. This is just what I wanted.
    I have a kind request, can I get the codes you used in this video please? Because the ones in your repo seem to be a little different. I want to create a similar web app to inference my yolo model on.

  • @lilkeem2101
    @lilkeem2101 Рік тому

    Can i use pretrained model yolov5 in the code?

  • @danyangli8346
    @danyangli8346 Рік тому

    Can you pls share the weights file?

  • @roxxy1683
    @roxxy1683 Рік тому

    Nice tutorial ma'am. Please give dataset reference as well.

    • @CodeWithAarohi
      @CodeWithAarohi  Рік тому +1

      universe.roboflow.com/roboflow-universe-projects/construction-site-safety

  • @danyangli8346
    @danyangli8346 Рік тому

    If training Yolo v8 rather than v7, will the weight file be the same after training? And also can you pls share the steps on how to set up the flask App? Got an error when I tried to run the project.

    • @CodeWithAarohi
      @CodeWithAarohi  Рік тому

      The weight file may not be the same as the YOLOv7 weight file after training because the architecture and hyperparameters of the YOLOv8 model may differ from those of the YOLOv7 model, resulting in different weight values.

  • @anikaafrin3351
    @anikaafrin3351 Рік тому

    Can you tell me the version of flask you used whil running the code?

  • @swapniltekale
    @swapniltekale 6 місяців тому

    Hello mam, i am confused regarding environment setup and running code locally can you please send me step wise instructions and which ide to use.

    • @CodeWithAarohi
      @CodeWithAarohi  6 місяців тому

      python -m virtualenv myvenv
      myvenv\Scripts\activate
      python -m pip install --upgrade pip
      git clone github.com/WongKinYiu/yolov7
      cd yolov7
      pip install -r requirements.txt

  • @BEProject-mh9wq
    @BEProject-mh9wq Рік тому

    Can you create a video explaining the training results and curves of performance

  • @samehhussien3412
    @samehhussien3412 Рік тому

    please,give me function that do real time.

  • @Aisyah0510
    @Aisyah0510 Рік тому +1

    Mam, could you please make a tutorial about object detection using Mask-RCNN and flask | object detection web application
    The Mask-RCNN method uses the latest version of tensorflow

  • @its_sagar371
    @its_sagar371 Рік тому +1

    mam can we modify webapp,py file to send alert message in telegram after object detection

    • @CodeWithAarohi
      @CodeWithAarohi  Рік тому

      Yes

    • @CodeWithAarohi
      @CodeWithAarohi  Рік тому

      Here's a general approach to achieve this:
      Set up a Telegram bot:
      Create a new bot in Telegram by following the instructions provided by the BotFather.
      Obtain the bot token that will be used to authenticate your bot.
      Install the required packages:
      Install the 'telegram-send' package using pip or another package manager.
      Modify the Flask application:
      Import the 'telegram-send' module in your Flask application (webapp.py file).
      After the object detection has been performed, write a function that sends a message to your Telegram bot using the 'telegram-send' package.
      Within this function, include the details of the object detection, such as the name of the object detected and the confidence score.
      Call this function after the object detection is complete.

  • @vikasm1872
    @vikasm1872 Рік тому

    Can i do the same process with yolo v5 weights file. Please do reply and Thank you so much for uploading such a informative video

    • @CodeWithAarohi
      @CodeWithAarohi  Рік тому +1

      Yes, You can

    • @vikasm1872
      @vikasm1872 Рік тому

      @@CodeWithAarohi Can u pls help me with what and which places i have to replace in order to get yolo v5

    • @CodeWithAarohi
      @CodeWithAarohi  Рік тому

      @@vikasm1872 Where I am uploading the yolov8 model. Replace that with your yolov5 model.

  • @TrinoQuintana-bc4yf
    @TrinoQuintana-bc4yf Рік тому

    Hello, I was looking at the code, I am interested in learning a little more, can you please provide me with the code that you have in the video, it is for my learning.

    • @CodeWithAarohi
      @CodeWithAarohi  Рік тому

      Send me an email at aarohisingla1987@gmail.com

  • @rajulaveti4371
    @rajulaveti4371 Рік тому

    how can i capture real time window instead of real time webcam ... plz help me mam

    • @CodeWithAarohi
      @CodeWithAarohi  Рік тому

      you can use a screen capture library such as PyAutoGUI or mss (multiple screen capture).

  • @khoirunnisa0606
    @khoirunnisa0606 Рік тому

    Can you make detection using yolov8 and django?

  • @AtikulIslamSajib-rt4ez
    @AtikulIslamSajib-rt4ez Рік тому

    hello, I am level 2 membership of this channel. Would you please share the code including flask and notebook to me ? The code in the Github is not completed yet. I am looking forward to receiving a kind reply from you.

    • @CodeWithAarohi
      @CodeWithAarohi  Рік тому +1

      Sure, I will share. Mail me at aarohisingla1987@gmail.com

  • @sachinmorabada
    @sachinmorabada Рік тому

    Can you make video with front end with angular or react ?

  • @islampath2success41
    @islampath2success41 Рік тому

    Cant we add more objects i need this project for minors i am helpess anyone help me here

    • @CodeWithAarohi
      @CodeWithAarohi  Рік тому +1

      Yes, You can add as many objects you want to add. Add images in your dataset and there corresponding txt annotations. After that modify your data.yaml file according to that

    • @islampath2success41
      @islampath2success41 Рік тому

      @@CodeWithAarohi thank you mam

  • @aniket3585
    @aniket3585 Рік тому

    Mam, It was a Great Video. But mam the Github Code is not complete so can you share the link of your full code.
    It will be very helpfull, Thank you

    • @CodeWithAarohi
      @CodeWithAarohi  Рік тому

      I have provided the base design for this web app. If yo want to modify that then you can do changes in index.html as per your requirement.

  • @ProKnowledge
    @ProKnowledge Рік тому

    rtsp_feed is not opening after running and not in github. can you share new code? please reply

    • @CodeWithAarohi
      @CodeWithAarohi  Рік тому

      what is the exact error you are getting while using rtsp_stream

    • @ProKnowledge
      @ProKnowledge Рік тому

      @@CodeWithAarohi after clicking icon website don't respond

  • @typhoontab2429
    @typhoontab2429 Рік тому

    how to make a webpage for real-time object detection using webcam?

    • @CodeWithAarohi
      @CodeWithAarohi  Рік тому

      camera = cv2.VideoCapture(0)
      def detect_objects(frame):
      # Modify this function to detect objects in the frame
      # You can use any object detection library or algorithm here
      # The output should be an annotated frame with bounding boxes or other visualizations
      @app.route('/')
      def index():
      return render_template('index.html')
      def generate_frames():
      while True:
      success, frame = camera.read()
      if not success:
      break
      else:
      frame = detect_objects(frame)
      ret, buffer = cv2.imencode('.jpg', frame)
      frame = buffer.tobytes()
      yield (b'--frame
      '
      b'Content-Type: image/jpeg

      ' + frame + b'
      ')
      @app.route('/video_feed')
      def video_feed():
      return Response(generate_frames(), mimetype='multipart/x-mixed-replace; boundary=frame')

  • @seetharamnageshappe5013
    @seetharamnageshappe5013 Рік тому

    set_logging(verbose=verbose)
    TypeError: set_logging() got an unexpected keyword argument 'verbose'
    Getting this error while running app

    • @CodeWithAarohi
      @CodeWithAarohi  Рік тому

      Check the Flask version you are using by running pip show flask. Make sure you are using the latest version of Flask or at least version 1.1.0, which introduced support for the verbose parameter.

  • @muhammadmubashirgujjar2322
    @muhammadmubashirgujjar2322 Рік тому

    how to use this for yolov5 custom model?

    • @CodeWithAarohi
      @CodeWithAarohi  Рік тому

      Only replace the yolo v7 model with yolov5 model. And modify few lines which are responsible to show bounding boxes of yolov5

    • @muhammadmubashirgujjar2322
      @muhammadmubashirgujjar2322 Рік тому

      @@CodeWithAarohi can you please make the tutorial on how to make yolov5 object detection web application

  • @samehhussien3412
    @samehhussien3412 Рік тому

    Can you help me how to do it in flutter, please ?

  • @tyronetyrone2652
    @tyronetyrone2652 9 місяців тому

    👋

  • @shahinamini7047
    @shahinamini7047 Рік тому

    I need to know how to track workers

    • @CodeWithAarohi
      @CodeWithAarohi  Рік тому

      As the workers are Person and there are various tracking pretrained models. You can use any of them.

  • @user-ep3pm5zl7b
    @user-ep3pm5zl7b 11 місяців тому

    Aarohi please create a video on deploying the yolov7 tflite to an android studio to get apk

  • @shrinand.sawant
    @shrinand.sawant 2 місяці тому +1

    Hi mam, I have taken 2nd level subscription. Can you provide me the code of this video please.

    • @CodeWithAarohi
      @CodeWithAarohi  2 місяці тому

      Please email me at aarohisingla1987@gmail.com

  • @anikaafrin3351
    @anikaafrin3351 Рік тому

    Will you kindly share me the design code.. It is not coming like as it is shown in the video...kindly share please.

    • @CodeWithAarohi
      @CodeWithAarohi  Рік тому

      You can modify the designing files as per your design requirements

    • @anikaafrin3351
      @anikaafrin3351 Рік тому

      @@CodeWithAarohi Can you send me your one kindly? again there is showing an error no attribute called imgpath in predict_img... why is it showing?

  • @naveenpaliwal3884
    @naveenpaliwal3884 5 місяців тому

    Hello Mam, How to reach you?

  • @PARIGELARAJKUMAR
    @PARIGELARAJKUMAR Рік тому +1

    maam please provide exact html code in your github account

    • @CodeWithAarohi
      @CodeWithAarohi  Рік тому

      This code is for Level 2 members of my channel.

  • @ramanathanr6508
    @ramanathanr6508 Рік тому

    please share the jupyter notebook mam

    • @CodeWithAarohi
      @CodeWithAarohi  Рік тому

      This code is for Level 2 members of my channel.

  • @swapniltekale
    @swapniltekale 6 місяців тому +1

    Hi Mam, I have 2nd level subscription. Can you please share me code of this video.

  • @nit8826
    @nit8826 Рік тому

    Dear aarohi,
    Please upload requirements.txt 🙏🙏

    • @CodeWithAarohi
      @CodeWithAarohi  Рік тому

      python -m virtualenv myvenv or py -3.9 -m venv myvenv
      myvenv\Scripts\activate
      python -m pip install --upgrade pip
      git clone github.com/WongKinYiu/yolov7
      cd yolov7
      pip install -r requirements.txt
      #after this getting pytorch compatible with cuda. So installed pytorch again with cuda 11.6
      pip install torch==1.12.1+cu116 torchvision==0.13.1+cu116 torchaudio==0.12.1 --extra-index-url download.pytorch.org/whl/cu116

    • @CodeWithAarohi
      @CodeWithAarohi  Рік тому

      Also. Take the requirements.txt from official yolov7 repo

    • @nit8826
      @nit8826 Рік тому

      Can't we do this without cuda

    • @CodeWithAarohi
      @CodeWithAarohi  Рік тому

      @@nit8826 you have to compile the pytorch with cuda if you want to use GPU. Otherwise just run the official yolov7 requirements.txt and you will have the setup which will work with cpu

  • @harshaldharpure9921
    @harshaldharpure9921 Рік тому

    where is 'best_246.pt' file

    • @CodeWithAarohi
      @CodeWithAarohi  Рік тому

      This is your custom model. You have to paste it in your flask app directory manually.

  • @thulanideriv4542
    @thulanideriv4542 Рік тому +1

    Webcam not working internal server error. The server encountered an error and was unable to complete your request. Either the server is overloaded or there is error in the application

  • @hedrysham9359
    @hedrysham9359 Рік тому

    i want to join level 2 member, please

    • @CodeWithAarohi
      @CodeWithAarohi  Рік тому

      You can click on "Join" button and then choose Contribution Level-2

    • @hedrysham9359
      @hedrysham9359 Рік тому

      i already pay, hopefully can get yr kind reply on email🥺

  • @ajayreddykanduru453
    @ajayreddykanduru453 Рік тому

    Its not working for webcam

  • @yxminz6885
    @yxminz6885 10 місяців тому

    hello, I am level 2 membership of this channel. Would you please share the code including flask and notebook to me ? The code in the Github is not completed yet. I am looking forward to receiving a kind reply from you.