/fire-detect-yolov4

fire-smoke-detection-dataset and fire-detection-yolov4 (with xml annotations),包含爬虫代码。

Primary LanguagePython

fire-detect-yolov4-5 and fire-detect-dataset

  • author is leilei
  • fire-detection qq群: 980489677
  • 如果此项目对您有所帮助,请给个star,您的star是对我的鼓励!

new open-source dataset

Some details

  • En: Open source again smoke-fire detection data 10827 sheets (including 2059 labels):
  • Ch: 再次开源烟雾-火灾检测数据10827张(含2059个标注),仍然需要下载 latest-fire-dataset合并:


How to use dataset?

  • We annotate the fire-detection-dataset as Pascal VOC format:
    --VOC2020
        --Annotations (xml_num: 2059)
        --ImageSets(Main)
        --JPEGImages (image_num: 2059)
        
        --label_name: fire
    
  • Unzip **.tar file command
    请不要再问我如何解压!
    tar -xzvf ***.tar  (win or linux: Git Bash)
    or 
    7zip (win: 7zip; 360zip need 2 time unzip)
    
  • If you want to convert VOC to YOLO format:
    Call darknet-yolov4's scripts voc_label.py
    
  • Fire scene:
    vehicle-fire、grassland-fire、forest-fire、building-fire、Big and small fire、Day and night fire;
    
  • Crawl fire-smoke images
    * crawl baidu images: test_baidu.py
    * crawl google images: test_google.py
    

How to use this code (test)?

  1. installed darknet-yolov4, and put darknet_API.py into ./darknet
  2. put cfg into ./darknet
  3. download fire-yolov4's weight, and put it in backup_fire folder
  4. Call the darknet_API main function:
    from darknet_API import Detect
    detect = Detect(metaPath=r'./cfg/fire.data', configPath=r'./cfg/yolov4-fire.cfg',\
                    weightPath=r'./backup_fire/yolov4-fire_best.weights',\
                    namesPath=r'./cfg/fire.names')
    image = cv2.imread(r'/home/Datasets/20200714085948.jpg', -1)
    draw_img = detect.predict_image(image, save_path='./pred.jpg')
    
  5. The latest version of darknet has modified darknet.py and can directly perform image detection based on it.
  • Note:
    • This project should be placed in the ./darknet folder;
    • Fire generally coexists with smoke, but we only marked fire;
    • In addition, it is easy to confuse the negative sample of the fire and the light;

How to train yolov4 in darknet (train)?

  1. Convert VOC format data to YOLO format data
  2. Configure file information such as cfg
  3. Call the darknet command:
    ./darknet detector train cfg/fire.data cfg/yolov4-fire.cfg yolov4.conv.137 -gpus 0 -map -dont_show
    

demo

  • ./result: fire-detect demos
fire-detect-demo
  • ./xml_lab: fire-detection image annotations
fire-detect-annotation

Cite

Reputation:

  • This data set contains 2 parts:
  • (1) Images crawled by myself, marked by myself
  • (2) The data that others open source, some have annotations, some have no annotations (I re-annotate it)
  • 本数据仅学术探索!!!

Other