DarkNet--分类 ./darknet classifier train/valid/test

本文详细解析了在训练过程中遇到'toomanyfortoofewlabels'错误的原因,通常是因为数据集中标签不平衡或者标签重复导致。文章提供了检查labels.txt文件和图片路径的正确方法,帮助读者避免这一常见问题。

注意在labels.txt文件中,比如 类别 是 BV和NOBV,因为'BV'的是重复的,所以在训练过程中会提示

'too many for too few labels',在图片的路径中,也不要写。

 

將代碼改為在本機訓練yolov !git clone https://github.com/AlexeyAB/darknet # **Instructions**: ### 1 - Upload this notebook on [Google Colab](https://colab.research.google.com/) (this notebook need to run on Google Colab). ### 2 - Open the notebook on Google Colab. ### 3 - Change the Google Colab runtime to "GPU" by navigating to "Runtime" > "Change runtime type" ### 4 - Run all cells to start training your model. ### 5 - After the last command finish its execution, copy the file ```yolov4-tiny/training/yolov4-tiny-custom_last.weights``` from your google drive to the cloned project in the same folder as the 4_yolo_opencv_detector notebook. %cd .. from google.colab import drive drive.mount('/content/gdrive') !ln -s /content/gdrive/My\ Drive/ /mydrive ls /mydrive/yolov4-tiny #%% %cd /content/darknet/ !sed -i 's/OPENCV=0/OPENCV=1/' Makefile !sed -i 's/GPU=0/GPU=1/' Makefile !sed -i 's/CUDNN=0/CUDNN=1/' Makefile !sed -i 's/CUDNN_HALF=0/CUDNN_HALF=1/' Makefile !sed -i 's/LIBSO=0/LIBSO=1/' Makefile #%% !make #%% %cd data/ !find -maxdepth 1 -type f -exec rm -rf {} \; %cd .. %rm -rf cfg/ %mkdir cfg #%% !cp /mydrive/yolov4-tiny/obj.zip ../ !unzip ../obj.zip -d data/ !cp /mydrive/yolov4-tiny/yolov4-tiny-custom.cfg ./cfg !cp /mydrive/yolov4-tiny/obj.names ./data !cp /mydrive/yolov4-tiny/obj.data ./data !cp /mydrive/yolov4-tiny/process.py ./ !cp /mydrive/yolov4-tiny/yolov4-tiny.conv.29 ./ #%% !python process.py #%% !ls data/ #%% !./darknet detector train data/obj.data cfg/yolov4-tiny-custom.cfg yolov4-tiny.conv.29 -dont_show
11-11
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值