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
Double click on yolov4_config.py
to edit model parameters.
More details about the meaning of each parameter can be found here
!python yolov4_setup.py
!./darknet detector train data/yolov4.data cfg/yolov4_custom_train.cfg {weights_path} -map
-
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
YOLOv4 in Google Colab: Train your Custom Dataset (Traffic Signs) with ease