当前位置:网站首页>Yolov3 trains its own data set to generate train txt
Yolov3 trains its own data set to generate train txt
2022-07-02 19:05:00 【FeboReigns】
from os.path import join
import os
img_dir = "images"
work_dir = os.getcwd()
print (" Current working directory : %s" % work_dir)
txt_file = open(work_dir+'/train.txt', 'w')
img_path = join(work_dir,img_dir)
print (" Picture folder :",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 This is it py The path of the script , such as E:\workspace\classify
img_dir Is the path of the dataset image , For example, I put all the pictures in ,E:\workspace\classify\images in
I'm going to put work_dir +“images”, Got it. img_dir, If your path is different from, modify it by yourself
Then traverse img_dir All under jpg picture , If you are another picture, you put if file_name.endswith(".jpg") Make a change , Don't judge the suffix , Write the absolute path of each picture in txt in .

Pay attention to the , stay win System generated txt, Can't put linux of use , Because of the backslash .
边栏推荐
- 高频面试题
- options should NOT have additional properties
- 距离度量 —— 杰卡德距离(Jaccard Distance)
- Web version 3D visualization tool, 97 things programmers should know, AI frontier paper | information daily # 2022.07.01
- 深度学习数学基础
- R语言ggplot2可视化:gganimate包创建动态柱状图动画(gif)、使用transition_states函数在动画中沿给定维度逐步显示柱状图
- 9D电影是怎样的?(+维度空间常识)
- SLC、MLC、TLC 和 QLC NAND SSD 之间的区别:哪个更好?
- 页面标题组件
- 使用 Cheat Engine 修改 Kingdom Rush 中的金钱、生命、星
猜你喜欢

仿京东放大镜效果(pink老师版)

Singapore summer tourism strategy: play Singapore Sentosa Island in one day

彻底搞懂基于Open3D的点云处理教程!

Yesterday, Alibaba senior wrote a responsibility chain model, and there were countless bugs

使用CLion编译OGLPG-9th-Edition源码

迷你高尔夫球场:伦敦休闲旅游好去处

Introduction to the paper | application of machine learning in database cardinality estimation

M2DGR:多源多场景 地面机器人SLAM数据集(ICRA 2022 )

性能测试如何创造业务价值

拦截器与过滤器的区别
随机推荐
Mysql高级篇学习总结7:Mysql数据结构-Hash索引、AVL树、B树、B+树的对比
R语言ggplot2可视化分面图(facet):gganimate包基于transition_time函数创建动态散点图动画(gif)
UML class diagram
新手必看,點擊兩個按鈕切換至不同的內容
距离度量 —— 杰卡德距离(Jaccard Distance)
R语言ggplot2可视化:gganimate包创建动态柱状图动画(gif)、使用transition_states函数在动画中沿给定维度逐步显示柱状图
UML 类图
Learn the knowledge points of eight part essay ~ ~ 1
页面标题组件
Installation of thingsboard, an open source IOT platform
The student Tiktok publicized that his alma mater was roast about "reducing the seal of enrollment". Netizen: hahahahahahahaha
Which securities company has a low, safe and reliable online account opening commission
Singapore summer tourism strategy: play Singapore Sentosa Island in one day
Comprendre complètement le tutoriel de traitement de Point Cloud basé sur open3d!
SLC、MLC、TLC 和 QLC NAND SSD 之间的区别:哪个更好?
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
新加坡暑假旅游攻略:一天玩转新加坡圣淘沙岛
ORA-01455: converting column overflows integer datatype
R语言dplyr包filter函数筛选dataframe数据、如果需要筛选的数据列(变量)名称中包含引号则需要使用!!sym语法处理、否则因为无法处理引号筛选不到任何数据
How to play when you travel to Bangkok for the first time? Please keep this money saving strategy