ArFFy 34849860d5 | 1 year ago | |
---|---|---|
.ipynb_checkpoints | 1 year ago | |
.temp_map_out | 1 year ago | |
model_data | 1 year ago | |
nets | 1 year ago | |
utils | 1 year ago | |
utils_coco | 1 year ago | |
2007_train.txt | 1 year ago | |
2007_val.txt | 1 year ago | |
README.md | 1 year ago | |
get_map.py | 1 year ago | |
predict.py | 1 year ago | |
summary.py | 1 year ago | |
train_emo.py | 1 year ago |
链接:https://pan.baidu.com/s/1FX6wMvcfE674UZYp4j8OCA
提取码:d4c8
0.ops
conda install pytorch=1.10 torchvision torchaudio cudatoolkit=10.2 -c pytorch
1.ImportError: libtiff.so.5: cannot open shared object file: No such file or directory
apt-get install libtiff5-dev
2.AttributeError: module 'distutils' has no attribute 'version'
pip uninstall setuptools
pip install setuptools==59.5.0
3.ERROR: pip's dependency resolver does not currently take into account all the packages that are installed. This behaviour is the source of the following dependency conflicts.
jupyterlab 3.0.0 requires nbclassic~=0.2, but you have nbclassic 1.0.0 which is incompatible.
pip install --upgrade wheel setuptools pip慎用
pip install nbclassic~=0.2
2022-05
:修改backbone为swin transformer,进行训练
2022-04
:支持多GPU训练,新增各个种类目标数量计算,新增heatmap。
2022-03
:进行了大幅度的更新,支持step、cos学习率下降法、支持adam、sgd优化器选择、支持学习率根据batch_size自适应调整、新增图片裁剪。
BiliBili视频中的原仓库地址为:https://github.com/bubbliiiing/yolox-pytorch/tree/bilibili
2021-10
:创建仓库,支持不同尺寸模型训练、支持大量可调整参数,支持fps、视频预测、批量预测等功能。
模型 | 路径 |
---|---|
YoloV3 | https://github.com/bubbliiiing/yolo3-pytorch |
Efficientnet-Yolo3 | https://github.com/bubbliiiing/efficientnet-yolo3-pytorch |
YoloV4 | https://github.com/bubbliiiing/yolov4-pytorch |
YoloV4-tiny | https://github.com/bubbliiiing/yolov4-tiny-pytorch |
Mobilenet-Yolov4 | https://github.com/bubbliiiing/mobilenet-yolov4-pytorch |
YoloV5 | https://github.com/bubbliiiing/yolov5-pytorch |
YoloX | https://github.com/bubbliiiing/yolox-pytorch |
训练数据集 | 权值文件名称 | 测试数据集 | 输入图片大小 | mAP 0.5:0.95 | mAP 0.5 |
---|---|---|---|---|---|
COCO-Train2017 | yolox_nano.pth | COCO-Val2017 | 640x640 | 27.4 | 44.5 |
COCO-Train2017 | yolox_tiny.pth | COCO-Val2017 | 640x640 | 34.7 | 53.6 |
COCO-Train2017 | yolox_s.pth | COCO-Val2017 | 640x640 | 38.2 | 57.7 |
COCO-Train2017 | yolox_m.pth | COCO-Val2017 | 640x640 | 44.8 | 63.9 |
COCO-Train2017 | yolox_l.pth | COCO-Val2017 | 640x640 | 47.9 | 66.6 |
COCO-Train2017 | yolox_x.pth | COCO-Val2017 | 640x640 | 49.0 | 67.7 |
pytorch==1.2.0
训练所需的权值可在百度网盘中下载。
链接: https://pan.baidu.com/s/1bi2UBwwIHES0OpLeyYuBFg
提取码: f4ni
VOC数据集下载地址如下,里面已经包括了训练集、测试集、验证集(与测试集一样),无需再次划分:
链接: https://pan.baidu.com/s/1YuBbBKxm2FGgTU5OfaeC5A
提取码: uack
数据集的准备
本文使用VOC格式进行训练,训练前需要下载好VOC07+12的数据集,解压后放在根目录
数据集的处理
修改voc_annotation.py里面的annotation_mode=2,运行voc_annotation.py生成根目录下的2007_train.txt和2007_val.txt。
开始网络训练
train.py的默认参数用于训练VOC数据集,直接运行train.py即可开始训练。
训练结果预测
训练结果预测需要用到两个文件,分别是yolo.py和predict.py。我们首先需要去yolo.py里面修改model_path以及classes_path,这两个参数必须要修改。
model_path指向训练好的权值文件,在logs文件夹里。
classes_path指向检测类别所对应的txt。
完成修改后就可以运行predict.py进行检测了。运行后输入图片路径即可检测。
数据集的准备
本文使用VOC格式进行训练,训练前需要自己制作好数据集,
训练前将标签文件放在VOCdevkit文件夹下的VOC2007文件夹下的Annotation中。
训练前将图片文件放在VOCdevkit文件夹下的VOC2007文件夹下的JPEGImages中。
数据集的处理
在完成数据集的摆放之后,我们需要利用voc_annotation.py获得训练用的2007_train.txt和2007_val.txt。
修改voc_annotation.py里面的参数。第一次训练可以仅修改classes_path,classes_path用于指向检测类别所对应的txt。
训练自己的数据集时,可以自己建立一个cls_classes.txt,里面写自己所需要区分的类别。
model_data/cls_classes.txt文件内容为:
cat
dog
...
修改voc_annotation.py中的classes_path,使其对应cls_classes.txt,并运行voc_annotation.py。
开始网络训练
训练的参数较多,均在train.py中,大家可以在下载库后仔细看注释,其中最重要的部分依然是train.py里的classes_path。
classes_path用于指向检测类别所对应的txt,这个txt和voc_annotation.py里面的txt一样!训练自己的数据集必须要修改!
修改完classes_path后就可以运行train.py开始训练了,在训练多个epoch后,权值会生成在logs文件夹中。
训练结果预测
训练结果预测需要用到两个文件,分别是yolo.py和predict.py。在yolo.py里面修改model_path以及classes_path。
model_path指向训练好的权值文件,在logs文件夹里。
classes_path指向检测类别所对应的txt。
完成修改后就可以运行predict.py进行检测了。运行后输入图片路径即可检测。
img/street.jpg
_defaults = {
#--------------------------------------------------------------------------#
# 使用自己训练好的模型进行预测一定要修改model_path和classes_path!
# model_path指向logs文件夹下的权值文件,classes_path指向model_data下的txt
# 如果出现shape不匹配,同时要注意训练时的model_path和classes_path参数的修改
#--------------------------------------------------------------------------#
"model_path" : 'model_data/yolox_s.pth',
"classes_path" : 'model_data/coco_classes.txt',
#---------------------------------------------------------------------#
# 输入图片的大小,必须为32的倍数。
#---------------------------------------------------------------------#
"input_shape" : [640, 640],
#---------------------------------------------------------------------#
# 所使用的YoloX的版本。nano、tiny、s、m、l、x
#---------------------------------------------------------------------#
"phi" : 's',
#---------------------------------------------------------------------#
# 只有得分大于置信度的预测框会被保留下来
#---------------------------------------------------------------------#
"confidence" : 0.5,
#---------------------------------------------------------------------#
# 非极大抑制所用到的nms_iou大小
#---------------------------------------------------------------------#
"nms_iou" : 0.3,
#---------------------------------------------------------------------#
# 该变量用于控制是否使用letterbox_image对输入图像进行不失真的resize,
# 在多次测试后,发现关闭letterbox_image直接resize的效果更好
#---------------------------------------------------------------------#
"letterbox_image" : True,
#-------------------------------#
# 是否使用Cuda
# 没有GPU可以设置成False
#-------------------------------#
"cuda" : True,
}
img/street.jpg
No Description
Text Python
Dear OpenI User
Thank you for your continuous support to the Openl Qizhi Community AI Collaboration Platform. In order to protect your usage rights and ensure network security, we updated the Openl Qizhi Community AI Collaboration Platform Usage Agreement in January 2024. The updated agreement specifies that users are prohibited from using intranet penetration tools. After you click "Agree and continue", you can continue to use our services. Thank you for your cooperation and understanding.
For more agreement content, please refer to the《Openl Qizhi Community AI Collaboration Platform Usage Agreement》