Skip to content

Darknet repository for training YOLOv4 on Google Colab with Custom Dataset

License

Notifications You must be signed in to change notification settings

quangnhat185/darknet_for_colab

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

27 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Custom Darknet for training YOLOv4 on Google Colab with custom dataset

Setup darknet environment in Colab Notebook

To enable GPU backend for your notebook: Runtime->Change runtime type->Hardware Accelerator->GPU

# run these command line from notebook cell

!git clone https://github.com/quangnhat185/darknet_for_colab.git
%cd darknet_for_colab
!make
!chmod +x ./darknet

Tuning parameters from Colab environment

Double click on yolov4_config.pyto edit model parameters. More details about the meaning of each parameter can be found here


Generate YOLOv4 config and test file

!python yolov4_setup.py

Train with YOLOv4

!./darknet detector train data/yolov4.data cfg/yolov4_custom_train.cfg {weights_path} -map

Predict with YOLOv4

  • Image (predicted image is saved at predictions.jpg:

    %cp data/yolov4.data cfg/coco.data
    !./darknet detect cfg/yolov4_custom_test.cfg {weights_path} {img_path}
    
  • Video:

    usage: darknet_video.py [-h] -v VIDEO [-c CONFIG] -w WEIGHTS [-l LABEL]
                    [-m META] [-o OUTPUT]
    
    optional arguments:
      -h, --help            show this help message and exit
      -v VIDEO, --video VIDEO
                            Path to input video
      -c CONFIG, --config CONFIG
                            Path to yolo config file
      -w WEIGHTS, --weights WEIGHTS
                            Path to yolo weight
      -l LABEL, --label LABEL
                            Path to label file
      -m META, --meta META  Path to metaPath
      -o OUTPUT, --output OUTPUT
                            Path to output file  
    
    !python darknet_video.py -v {video path} -c cfg/yolov4_custom_test.cfg -w {weights_path}  -o output.mp4
    

Tutorial

YOLOv4 in Google Colab: Train your Custom Dataset (Traffic Signs) with ease

License

License

MIT License

About

Darknet repository for training YOLOv4 on Google Colab with Custom Dataset

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published