Fire Detection YOLOv8 with Python (real time & custom data)

Поделиться
HTML-код
  • Опубликовано: 12 янв 2025

Комментарии • 70

  • @L6FTY
    @L6FTY 11 месяцев назад +3

    My image folders were in different spots than roboflow uses now so I changed the data.yaml file to:
    test: ./test/images
    train: ./train/images
    val: ./valid/images

  • @rodrigocorte5289
    @rodrigocorte5289 9 месяцев назад

    Thanks for the video, very good explanation!!!

  • @GalactaGalaxy
    @GalactaGalaxy Год назад

    short and clear video, thanks

  • @aurgon_42121
    @aurgon_42121 10 месяцев назад +2

    I have changed the path according to my folders in google colab , but this line of code " !yolo task=detect mode=train model=yolov8s.pt data=/content/continuous_fire-6/data.yaml epochs=1 imgsz=640 plots=True" is showing the error like this "/bin/bash: line 1: yolo: command not found "
    plz tell me how to deal with it

    • @universityofthefuture2077
      @universityofthefuture2077  10 месяцев назад

      Have you install all necessary packages?

    • @aurgon_42121
      @aurgon_42121 10 месяцев назад

      Yes but, while importing yolo from ultralytics , it is showing a yellow underline below that
      I think its logical error

    • @universityofthefuture2077
      @universityofthefuture2077  10 месяцев назад

      Maybe it’s different version of the package?

    • @tabbabiyosr602
      @tabbabiyosr602 9 месяцев назад

      do you write all codes ??

  • @cuongmanh4846
    @cuongmanh4846 10 месяцев назад +1

    vscode you create ? time 3:45

  • @AnimoGameDev
    @AnimoGameDev 11 месяцев назад

    Thanks For This Tutorial Hope You Do More💚

  • @MOHAMMEDABDULLAHS21CSR063
    @MOHAMMEDABDULLAHS21CSR063 11 месяцев назад

    Thank you sir . done a greate job sir☺

  • @cuongmanh4846
    @cuongmanh4846 10 месяцев назад +2

    How come when downloading best.pt the main.py file is available

  • @alaamohamed5640
    @alaamohamed5640 9 месяцев назад +2

    how can get the bath of data

  • @rodrigocorte5289
    @rodrigocorte5289 9 месяцев назад +1

    Hi bro, thanks for responding so quickly!!
    I've tried several times and I can't get an alarm to sound when fire is detected.
    I used this code, but it doesn't work.
    Do you have any suggestions?
    # Function for fire detection and sound alert
    def detect_fire_and_alert():
    # Initialize the YOLO model
    model = YOLO('best.pt')
    # Performs continuous fire detection
    whileTrue:
    # Perform the prediction
    results = model.predict(source=0, imgsz=320, conf=0.6, show=True)
    # Checks for fire detections
    for detection in results.pred:
    if 'fire' in detection['names']:
    # If fire is detected, plays an alert sound
    playsound("alarm_sound.mp3")
    break # Breaks the loop when fire is detected
    # Function call for fire detection and audible alert
    detect_fire_and_alert()
    I would be very grateful if you could help me.
    I need your help!!

    • @universityofthefuture2077
      @universityofthefuture2077  8 месяцев назад +1

      Hi, now its late response, hah, but this snippet it’s quite unreadable, please provide some github repo

    • @rodrigocorte5289
      @rodrigocorte5289 8 месяцев назад +1

      @@universityofthefuture2077 i already solve the problem but thanks 😉

    • @romanshendo4784
      @romanshendo4784 8 месяцев назад

      @@universityofthefuture2077 guys can you help me please? a have a this problem to. Thanks

    • @romanshendo4784
      @romanshendo4784 8 месяцев назад

      @@rodrigocorte5289 can you help me please? a have a this problem to. Thanks

    • @romanshendo4784
      @romanshendo4784 8 месяцев назад

      @@rodrigocorte5289 can you help me please?i hame i same problem

  • @karimmerchaoui9736
    @karimmerchaoui9736 9 месяцев назад

    Why do you do the training in google collab and the prediction in your local environment ?

    • @universityofthefuture2077
      @universityofthefuture2077  9 месяцев назад +1

      Prediction is quite fast even without gpu and real-time video streaming on Colab requires some additional set up:)

  • @coolghoul9
    @coolghoul9 8 месяцев назад

    Does holding a plastic spoon give a false positive

  • @kingclash1169
    @kingclash1169 10 месяцев назад +1

    How to download the run file to the device?

  • @lukbeatz7475
    @lukbeatz7475 11 месяцев назад +1

    thanks bro, saved me

  • @MuhamadNoorIman
    @MuhamadNoorIman 6 месяцев назад

    great video! can i used the same coding on jupyter notebook?

  • @jhansip5002
    @jhansip5002 4 месяца назад +1

    Sir...i want this code and output..

  • @tabbabiyosr602
    @tabbabiyosr602 9 месяцев назад

    give me the url of yolov8 in colab please

  • @rodrigocorte5289
    @rodrigocorte5289 9 месяцев назад

    Hey !! Is there any way to sound an alarm when a fire is detected? Please respond, I really need your help!!

    • @universityofthefuture2077
      @universityofthefuture2077  9 месяцев назад +1

      Hi, what do you mean? You can add simple alarm with for example playsound library.

    • @rodrigocorte5289
      @rodrigocorte5289 9 месяцев назад

      @@universityofthefuture2077 Hello and thanks for the quick response!!
      It's not that simple, I put an if to play sound when it detects fire but it doesn't work.
      I tried with this code :
      from ultralytics import YOLO
      from playsound import playsound
      # Função para detecção de fogo e alerta sonoro
      def detect_fire_and_alert():
      # Inicializa o modelo YOLO
      model = YOLO('best.pt')
      # Realiza a detecção contínua de fogo
      while True:
      # Realiza a predição
      results = model.predict(source=0, imgsz=320, conf=0.6, show=True)
      # Verifica se há detecções de fogo
      for detection in results.pred:
      if 'fire' in detection['names']:
      # Se o fogo for detectado, reproduz um som de alerta
      playsound("alarm_sound.mp3")
      break # Interrompe o loop quando o fogo é detectado
      # Chamada da função para detecção de fogo e alerta sonoro
      detect_fire_and_alert()
      I can´t do it, could you help me with this

    • @rodrigocorte5289
      @rodrigocorte5289 9 месяцев назад

      @@universityofthefuture2077 Hi bro, thanks for responding so quickly
      It's not that simple, I've already tried with this code and I'm not succeeding.
      from ultralytics import YOLO
      from playsound import playsound
      # Function for fire detection and sound alert
      def detect_fire_and_alert():
      # Initialize the YOLO model
      model = YOLO('best.pt')
      # Performs continuous fire detection
      whileTrue:
      # Perform the prediction
      results = model.predict(source=0, imgsz=320, conf=0.6, show=True)
      # Checks for fire detections
      for detection in results.pred:
      if 'fire' in detection['names']:
      # If fire is detected, plays an alert sound
      playsound("alarm_sound.mp3")
      break # Breaks the loop when fire is detected
      # Function call for fire detection and audible alert
      detect_fire_and_alert()
      If you could help I would be very grateful

    • @rodrigocorte5289
      @rodrigocorte5289 9 месяцев назад

      @@universityofthefuture2077 Hi bro, thanks for responding so quickly.
      This is not that simple. I've tried several times and still haven't managed to get an alarm to sound when it detects the fire.
      I used this code and I can't do it, do you have any suggestions?
      from ultralytics import YOLO
      from playsound import playsound
      # Function for fire detection and sound alert
      def detect_fire_and_alert():
      # Initialize the YOLO model
      model = YOLO('best.pt')
      # Performs continuous fire detection
      whileTrue:
      # Perform the prediction
      results = model.predict(source=0, imgsz=320, conf=0.6, show=True)
      # Checks for fire detections
      for detection in results.pred:
      if 'fire' in detection['names']:
      # If fire is detected, plays an alert sound
      playsound("alarm_sound.mp3")
      break # Breaks the loop when fire is detected
      # Function call for fire detection and audible alert
      detect_fire_and_alert()
      I would be very grateful if you could help me.
      Bro i really need your help!!

    • @rodrigocorte5289
      @rodrigocorte5289 9 месяцев назад

      @@universityofthefuture2077 Hi bro, thanks for responding so quickly!!
      I've tried several times and I can't get an alarm to sound when fire is detected.
      I used this code, but it doesn't work.
      Do you have any suggestions?
      # Function for fire detection and sound alert
      def detect_fire_and_alert():
      # Initialize the YOLO model
      model = YOLO('best.pt')
      # Performs continuous fire detection
      whileTrue:
      # Perform the prediction
      results = model.predict(source=0, imgsz=320, conf=0.6, show=True)
      # Checks for fire detections
      for detection in results.pred:
      if 'fire' in detection['names']:
      # If fire is detected, plays an alert sound
      playsound("alarm_sound.mp3")
      break # Breaks the loop when fire is detected
      # Function call for fire detection and audible alert
      detect_fire_and_alert()
      I would be very grateful if you could help me.
      I need your help!!

  • @kingclash1169
    @kingclash1169 11 месяцев назад +1

    where is best.pt file i can't find it

    • @universityofthefuture2077
      @universityofthefuture2077  11 месяцев назад

      In my case it was in PROJECT/runs/detect/train/weights/best.pt, but if you are using different version of the ultralytics package, the path can be slightly different.

  • @user-sx5ib8vd6l
    @user-sx5ib8vd6l 10 месяцев назад

    well done dawg

  • @aurgon_42121
    @aurgon_42121 10 месяцев назад

    showing the error of API KEy
    , when i paste the snippet from roboflow,,,

  • @bangipin361
    @bangipin361 Год назад +1

    I've followed what's in the video but I always fail

    • @universityofthefuture2077
      @universityofthefuture2077  Год назад +1

      Hi, which part of the code fails?

    • @L6FTY
      @L6FTY 11 месяцев назад +1

      try updating your paths to the image folders in data.yaml:
      test: ./test/images
      train: ./train/images
      val: ./valid/images

  • @aidajam3294
    @aidajam3294 3 месяца назад

    Are you Portuguese dude ? 😊

  • @GayathriSingamsetty-p5l
    @GayathriSingamsetty-p5l 2 месяца назад

    Can you please send me the code and result please

  • @R1cS0
    @R1cS0 9 месяцев назад

    Great video! Thanks for sharing it! Here's a question: could the small Yolo model be used directly on an ESP32Cam to detect a fire and set an alarm (as already covered in the comments below), send a message, etc.?

    • @universityofthefuture2077
      @universityofthefuture2077  8 месяцев назад

      Thanks! You can easily export yolo to tflite format (details here: docs.ultralytics.com/integrations/tflite/#deployment-options-in-tflite). I’ve never done this, so I am not sure if ESP can handle it, but probably yes. Hover if your goal is just to make it run, it would be much easier to use rpi zero for example:)

  • @L6FTY
    @L6FTY 11 месяцев назад

    How many epochs make sense here?

    • @universityofthefuture2077
      @universityofthefuture2077  11 месяцев назад

      Really depends on your goal. You should keep track of loss chart, if the curve stops going down, it's sign that probably further training is not going to make it better.

  • @aisyahzulaikha01
    @aisyahzulaikha01 Год назад

    How to appear run folder in vs code?

    • @universityofthefuture2077
      @universityofthefuture2077  Год назад

      After you run the script, the folder should be created automatically in the project root directory

    • @aisyahzulaikha01
      @aisyahzulaikha01 Год назад

      @@universityofthefuture2077 alright thank youu, I will try it

    • @houdabekkourialami3581
      @houdabekkourialami3581 11 месяцев назад

      I followed the same instructions but the webcam doesn't run for me. The webcam is activated and all. What can be the problem?

    • @MuhamadNoorIman
      @MuhamadNoorIman 6 месяцев назад

      @@universityofthefuture2077 where to find the project root directory?

  • @ĐứcHuỳnhTấn-b1s
    @ĐứcHuỳnhTấn-b1s Год назад

    dataset ?

  • @GayathriSingamsetty-p5l
    @GayathriSingamsetty-p5l 2 месяца назад

    Hlo

  • @syedyadishalikhan8326
    @syedyadishalikhan8326 Год назад

    source code

  • @wanpanman5492
    @wanpanman5492 Год назад +3

    not a very in depth tutorial