move convert dir to tools dir

This commit is contained in:
tzutalin 2021-02-28 11:06:13 -08:00
parent bfda006576
commit d8fdd478ef
2 changed files with 12 additions and 10 deletions

View File

@ -1,12 +1,14 @@
# Convert the label files to CSV # Additional tools
## Introduction ## 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). 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. `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 ### Structures
* Images * 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. 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) <bucket_name> (on the cloud storage)
@ -21,7 +23,7 @@ To train the images on [Google Cloud AutoML](https://cloud.google.com/automl), w
| ... | ...
``` ```
Note, URI of the `class1_01.jpg` is `gs://<bucket_name>/class1/class1_01.jpg` Note, URI of the `class1_01.jpg` is `gs://<bucket_name>/class1/class1_01.jpg`
* Labels * Labels
There are four types of training data - `TRAINING`, `VALIDATION`, `TEST` and `UNASSIGNED`. To assign different categories, we should create four directories. 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). Inside each folder, users should create the class folders with the same name in cloud storage (see below structure).
``` ```
@ -33,7 +35,7 @@ To train the images on [Google Cloud AutoML](https://cloud.google.com/automl), w
| | -- class2 | | -- class2
| | | -- class2_01.txt (or .xml) | | | -- class2_01.txt (or .xml)
| | | ... | | | ...
| | ... | | ...
| -- VALIDATION | -- VALIDATION
| | -- class1 | | -- class1
| | | -- class1_02.txt (or .xml) | | | -- class1_02.txt (or .xml)
@ -41,14 +43,14 @@ To train the images on [Google Cloud AutoML](https://cloud.google.com/automl), w
| | -- class2 | | -- class2
| | | -- class2_02.txt (or .xml) | | | -- class2_02.txt (or .xml)
| | | ... | | | ...
| | ... | | ...
| -- TEST | -- TEST
| | (same as TRAINING and VALIDATION) | | (same as TRAINING and VALIDATION)
| -- UNASSIGNED | -- UNASSIGNED
| | (same as TRAINING and VALIDATION) | | (same as TRAINING and VALIDATION)
``` ```
## Usage ### Usage
To see the argument of `label_to_csv.py`, To see the argument of `label_to_csv.py`,
```commandline ```commandline
@ -82,4 +84,4 @@ python label_to_csv.py \
``` ```
The output file is `res.csv` by default. Afterwards, upload the csv file to the cloud storage and you can start training! The output file is `res.csv` by default. Afterwards, upload the csv file to the cloud storage and you can start training!

0
convert/label_to_csv.py → tools/label_to_csv.py Normal file → Executable file
View File