# 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!
没有合适的资源?快使用搜索试试~ 我知道了~
资源推荐
资源详情
资源评论
收起资源包目录
目标检测标注工具-labelImg (165个子文件)
test.512.512.bmp 257KB
setup.cfg 105B
config 299B
description 73B
exclude 240B
.gitignore 448B
.gitignore 120B
.gitignore 10B
HEAD 184B
HEAD 184B
HEAD 32B
HEAD 23B
app.icns 8B
pack-c073f2098e677253bbf574df196ee392e9903c09.idx 58KB
MANIFEST.in 315B
index 11KB
demo3.jpg 89KB
demo.jpg 57KB
臉書.jpg 747B
LICENSE 1KB
Makefile 555B
master 184B
master 41B
README.md 3KB
README.md 489B
issue_template.md 152B
pack-c073f2098e677253bbf574df196ee392e9903c09.pack 237.14MB
packed-refs 2KB
label-studio-1-6-player-screenshot.png 4.31MB
demo5.png 3.09MB
demo4.png 2.71MB
labelimg.png 41KB
app.png 31KB
prev.png 30KB
next.png 30KB
feBlend-icon.png 8KB
format_createml.png 4KB
resetall.png 4KB
close.png 3KB
verify.png 3KB
save-as.png 3KB
labels.png 2KB
color_line.png 2KB
fit.png 2KB
done.png 2KB
cancel.png 2KB
open.png 2KB
undo.png 2KB
undo-cross.png 2KB
quit.png 2KB
help.png 2KB
delete.png 1KB
color.png 1KB
fit-width.png 1KB
eye.png 1KB
save.png 1KB
zoom.png 1KB
objects.png 1KB
fit-window.png 1KB
zoom-in.png 1KB
edit.png 1KB
zoom-out.png 1KB
new.png 977B
format_voc.png 786B
file.png 765B
format_yolo.png 675B
copy.png 646B
light_reset.png 587B
light_darken.png 487B
light_lighten.png 477B
expert2.png 335B
expert1.png 278B
strings-ja-JP.properties 3KB
strings.properties 3KB
strings-zh-CN.properties 3KB
strings-zh-TW.properties 2KB
resources.py 639KB
labelImg.py 72KB
canvas.py 29KB
label_to_csv.py 7KB
shape.py 7KB
pascal_voc_io.py 6KB
labelFile.py 6KB
yolo_io.py 5KB
test_io.py 4KB
create_ml_io.py 4KB
labelDialog.py 4KB
setup.py 4KB
utils.py 3KB
stringBundle.py 3KB
colorDialog.py 1KB
settings.py 1KB
toolBar.py 1KB
test_stringBundle.py 1KB
combobox.py 1000B
lightWidget.py 997B
default_label_combobox.py 907B
test_settings.py 815B
hashableQListWidgetItem.py 812B
zoomWidget.py 806B
共 165 条
- 1
- 2
资源评论
梦想编程家
- 粉丝: 92
- 资源: 1
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功