# Additional tools
## Convert the label files to CSV
### Introduction
To train the images on [Google Cloud AutoML](https://cloud.google.com/automl), we should prepare the specific csv files follow [this format](https://cloud.google.com/vision/automl/object-detection/docs/csv-format).
`label_to_csv.py` can convert the `txt` or `xml` label files to csv file. The labels files should strictly follow to below structure.
### Structures
* Images
To train the object detection tasks, all the images should upload to the cloud storage and access it by its name. All the images should stay in the **same buckets** in cloud storage. Also, different classes should have their own folder as below.
```
<bucket_name> (on the cloud storage)
| -- class1
| | -- class1_01.jpg
| | -- class1_02.jpg
| | ...
| -- class2
| | -- class2_01.jpg
| | -- class2_02.jpg
| | ...
| ...
```
Note, URI of the `class1_01.jpg` is `gs://<bucket_name>/class1/class1_01.jpg`
* Labels
There are four types of training data - `TRAINING`, `VALIDATION`, `TEST` and `UNASSIGNED`. To assign different categories, we should create four directories.
Inside each folder, users should create the class folders with the same name in cloud storage (see below structure).
```
labels (on PC)
| -- TRAINING
| | -- class1
| | | -- class1_01.txt (or .xml)
| | | ...
| | -- class2
| | | -- class2_01.txt (or .xml)
| | | ...
| | ...
| -- VALIDATION
| | -- class1
| | | -- class1_02.txt (or .xml)
| | | ...
| | -- class2
| | | -- class2_02.txt (or .xml)
| | | ...
| | ...
| -- TEST
| | (same as TRAINING and VALIDATION)
| -- UNASSIGNED
| | (same as TRAINING and VALIDATION)
```
### Usage
To see the argument of `label_to_csv.py`,
```commandline
python label_to_csv.py -h
```
```commandline
usage: label_to_csv.py [-h] -p PREFIX -l LOCATION -m MODE [-o OUTPUT]
[-c CLASSES]
optional arguments:
-h, --help show this help message and exit
-p PREFIX, --prefix PREFIX
Bucket of the cloud storage path
-l LOCATION, --location LOCATION
Parent directory of the label files
-m MODE, --mode MODE 'xml' for converting from xml and 'txt' for converting
from txt
-o OUTPUT, --output OUTPUT
Output name of csv file
-c CLASSES, --classes CLASSES
Label classes path
```
For example, if mine bucket name is **test**, the location of the label directory is **/User/test/labels**, the mode I choose from is **txt**, the output name and the class path is same as default.
```commandline
python label_to_csv.py \
-p test\
-l /User/test/labels \
-m txt
```
The output file is `res.csv` by default. Afterwards, upload the csv file to the cloud storage and you can start training!

徐浪老师
- 粉丝: 9536
最新资源
- React状态管理之温故知新_基于React_Hooks和Context_API实现声明式状态管理方案_通过createStateManager函数封装状态管理核心逻辑_使用imm.zip
- Kaleidoscope-LLVM教程中文翻译项目_详细解析LLVM编译器框架实现Kaleidoscope语言的全过程_提供完整的中文技术文档与代码示例_帮助中文开发者深入理解编译.zip
- 一键安装!BlenderMCP工具支持DeepSeek、Claude和其他工具,完全集成到Blender中!
- 基于进化算法与多目标优化的带障碍物环境智能路径规划仿真系统_实现动态障碍地图配置与多维度路径评估的可视化分析工具_用于机器人导航算法性能对比与路径平滑度优化的研究平台_集成遗传算法.zip
- 波束形成算法仿真比较项目_包含30余种不同波束形成算法的MATLAB与Python实现_用于阵列信号处理研究与教学_涵盖时域与频域波束形成技术_支持均匀线阵与圆阵配置_包含延迟求和.zip
- 基于MATLAB仿真环境实现PUMA560六自由度工业机械臂的RRT路径规划算法_机器人运动规划快速扩展随机树碰撞检测关节空间搜索三维路径优化动态障碍物避障蒙特卡洛采样.zip
- 基于多传感器融合的质心定位算法实现与优化_质心计算坐标定位传感器数据融合误差校正实时位置追踪三维空间建模动态环境适应多目标识别路径规划数据可视化_用于智能仓储机器.zip
- 基于Python的多智能体集群运动仿真系统_二维与三维空间中的智能体群体协同运动模拟与可视化分析_用于研究多智能体系统的自组织行为集群动力学及协同控制算法验证_NumPy数值计算.zip
- 人工势场法仿真系统_基于Qt框架实现的人工势场法基础与改进算法仿真绘图程序_用于毕业设计项目展示与算法性能对比分析_包含障碍物建模引力场与斥力场计算路径规划优化动态避障模拟.zip
- SidFive_vehicle-license-plate-recognition_46352_1756522075874.zip
- 免费PPT和PPTX文档高质量无损转换为图片格式的完整技术解决方案_基于LibreOffice和PDFBox实现跨平台文档转换_解决ApachePOI转换失真问题并支持Window.zip
- 基于Vue_2_开发的跨平台文件预览解决方案_支持Word_Excel_PPT_PDF等多种办公文档格式_提供本地文件与远程URL两种预览模式_采用PDF_js实现高性能分页渲染_.zip
- 基于阿里天池首届中文NL2SQL挑战赛的第六名解决方案项目_使用BERT预训练模型结合规则匹配与模糊查询技术实现自然语言到SQL查询语句的自动转换_旨在提升中文自然语言处理与数据库.zip
- 四足机器人仿真项目_基于虚拟模型控制算法的四足机器人运动仿真与步态优化_用于研究和开发四足机器人的稳定行走动态平衡控制以及复杂地形适应性通过仿真测试验证算法性能并优化机器人运动.zip
- 网格计算中资源管理与任务调度算法的Python实现示例_比较Max-Min与Min-Min两种经典动态调度策略的性能差异与适用场景_通过可视化调度过程与时间消耗分析帮助研究者理解算.zip
- wuzhixiang_Music_36836_1756522095132.zip
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈


