当前位置:网站首页>yolov3 训练自己的数据集之生成train.txt
yolov3 训练自己的数据集之生成train.txt
2022-07-02 17:34:00 【FeboReigns】
from os.path import join
import os
img_dir = "images"
work_dir = os.getcwd()
print ("当前工作目录 : %s" % work_dir)
txt_file = open(work_dir+'/train.txt', 'w')
img_path = join(work_dir,img_dir)
print ("图片文件夹 :",img_path)
image_names = os.listdir('./'+ img_dir)
for file_name in image_names:
if file_name.endswith(".jpg"):
txt_file.write(img_path + "/"+ file_name+"\n")
txt_file.close()
work_dir是此py脚本的路径,比如E:\workspace\classify
img_dir 是数据集图片的路径,比如我把图片都放在了,E:\workspace\classify\images中
我这里直接把work_dir +“images”,就得到了img_dir,如果你的路径和不一样自行修改一下
然后遍历img_dir下的所有jpg图片,如果你是别的图片你把 if file_name.endswith(".jpg") 改一改,不要判断后缀了,把每张图片的绝对路径写在txt中。
注意一下,在win系统生成的txt,不能放在linux 中用,因为反斜杠的原因。
边栏推荐
- PR曲线和ROC曲线概念及其区别
- Leetcode (81) -- search rotation sort array II
- Looking for innocence in New York -- a beautiful day at the discovery center of Legoland, New Jersey
- R language ggplot2 visual Facet: gganimate package is based on Transition_ Time function to create dynamic scatter animation (GIF)
- Matlab中弧度转角度、角度转弧度
- 300+ documents! This article explains the latest progress of multimodal learning based on transformer
- 27: Chapter 3: develop Passport Service: 10: [registration / login] interface: after the registration / login is OK, save the user session information (uid, utoken) to redis and cookies; (one main poi
- R语言使用epiDisplay包的lrtest函数对多个glm模型(logisti回归)执行似然比检验(Likelihood ratio test)对比两个模型的性能是否有差异、广义线性模型的似然比检
- Progress-进度条
- STM32G0 USB DFU 升级校验出错-2
猜你喜欢
科技公司不同人对Bug的反应 | 每日趣闻
电商系统中常见的 9 大坑,你踩过没?
Have you stepped on the nine common pits in the e-commerce system?
深度学习数学基础
How to clean up discarded PVs and their corresponding folders
Kubernetes three open interfaces first sight
Ali was wildly asked by the interviewer on three sides. Redis dared not write 'proficient' on his resume anymore
Web版3D可视化工具,程序员应该知道的97件事,AI前沿论文 | 资讯日报 #2022.07.01
The text editor hopes to mark the wrong sentences in red, and the text editor uses markdown
Troubleshooting: kubectl reports an error validationerror: unknown field \u00a0
随机推荐
How to delete the border of links in IE? [repeat] - how to remove borders around links in IE? [duplicate]
在Tensorflow2中使用mnist_784数据集进行手写数字识别
Leetcode (154) -- find the minimum value II in the rotation sort array
Deep neural network Summary
怎么用ps提取图片颜色分析色彩搭配
Installation of thingsboard, an open source IOT platform
How can retail enterprises open the second growth curve under the full link digital transformation
27: Chapter 3: develop Passport Service: 10: [registration / login] interface: after the registration / login is OK, save the user session information (uid, utoken) to redis and cookies; (one main poi
Night God simulator +fiddler packet capture test app
第一次去曼谷旅游怎么玩?这份省钱攻略请收好
Slam | how to align timestamps?
距离度量 —— 杰卡德距离(Jaccard Distance)
IPtable port redirection masquerade[easy to understand]
R语言ggplot2可视化分面图(facet):gganimate包基于transition_time函数创建动态散点图动画(gif)
Google's official response: we have not given up tensorflow and will develop side by side with Jax in the future
问题包含哪些环节
在纽约寻找童真——新泽西州乐高乐园探索中心的美好一天
R language uses Cox of epidisplay package Display function obtains the summary statistical information of Cox regression model (risk rate HR, adjusted risk rate and its confidence interval, P value of
在支付宝账户上买基金安全吗
Responses of different people in technology companies to bugs | daily anecdotes