API
ImgAnn.Sample
- show_samples
Function Description
show set of random images from the dataset with annotations.
Parameter |
Default value |
Description |
---|---|---|
data_path |
None |
relative path current folder, or absolute path to the main folder of the image dataset |
ann_path |
None |
relative path current folder, or absolute path to the main folder of the annotated file |
num_of_samples |
5 |
number of sample images to view in integer format |
ann_type |
‘coco’ |
annotation type of the file that given in the ‘ann_path’. supported names : [‘coco’, ‘voc’, ‘csv’, ‘yolo’] |
center |
True |
Only applicable in ‘coco’ annotation format. define in following note. |
image_shape |
[300, 300] |
image size in pixels for resulting images. |
seed |
0 |
if seed=0; resulting images will be always random. if seed>0, the resulting images will be same at each execution. |
Note
- describe_data
Function Description
show the summary of image dataset.
Parameter |
Default value |
Description |
---|---|---|
data_path |
None |
absolute or relative path to image dataset directory. effect of directory illustrated in the Usage section |
- describe_ann
Function Description
show the summary of image dataset with annotations.
Parameter |
Default value |
Description |
---|---|---|
data_path |
None |
absolute or relative path to image dataset main folder |
ann_path |
None |
absolute or relative path to image annotation file or folder |
ann_type |
‘coco’ |
annotation format [coco, voc, csv, yolo] |
center |
True |
Only applicable in ‘coco’ annotation format |
ImgAnn.Convertor
- coco2csv
Function Description
convert COCO annotation into CSV.
Parameter |
Default value |
Description |
---|---|---|
dataset_dir |
None |
relative path current folder, or absolute path to the main folder of the image dataset |
coco_ann_dir |
None |
relative path current folder, or absolute path to the main folder of the annotated file. Ex. ‘..data/annotations.json’ |
save_dir |
None |
annotation file saving location. Ex. ‘../data/annotations.csv’ |
center |
True |
defined in the above ‘Note’ |
is_multilabel |
False |
if ‘True’ output will be in CSV (Multi-label) format, else in CSV (Object Detection) format |
- coco2voc
Function Description
convert COCO annotation into PascalVOC.
Parameter |
Default value |
Description |
---|---|---|
dataset_dir |
None |
relative path current folder, or absolute path to the main folder of the image dataset |
coco_ann_dir |
None |
relative path current folder, or absolute path to the main folder of the annotated file. Ex. ‘..data/annotations.json’ |
save_dir |
None |
annotation file saving location. Ex. ‘../data/annotations/’ |
center |
True |
defined in the above ‘Note’ |
- coco2yolo
Function Description
convert COCO annotation into Yolo.
Parameter |
Default value |
Description |
---|---|---|
dataset_dir |
None |
relative path current folder, or absolute path to the main folder of the image dataset |
coco_ann_dir |
None |
relative path current folder, or absolute path to the main folder of the annotated file. Ex. ‘..data/annotations.json’ |
save_dir |
None |
annotation file saving location. Ex. ‘../data/annotations/’ |
center |
True |
defined in the above ‘Note’ |
- voc2coco
Function Description
convert PascalVOC annotation into COCO.
Parameter |
Default value |
Description |
---|---|---|
dataset_dir |
None |
relative path current folder, or absolute path to the main folder of the image dataset |
voc_ann_dir |
None |
relative path current folder, or absolute path to the main folder of the annotated file. Ex. ‘..data/annotations/’ |
save_dir |
None |
annotation file saving location. Ex. ‘../data/annotations.json’ |
center |
True |
defined in the above ‘Note’ |
- voc2csv
Function Description
convert PascalVOC annotation into CSV.
Parameter |
Default value |
Description |
---|---|---|
dataset_dir |
None |
relative path current folder, or absolute path to the main folder of the image dataset |
voc_ann_dir |
None |
relative path current folder, or absolute path to the main folder of the annotated file. Ex. ‘..data/annotations/’ |
save_dir |
None |
annotation file saving location. Ex. ‘../data/annotations.csv’ |
is_multilabel |
False |
if ‘True’ output will be in CSV (Multi-label) format, else in CSV (Object Detection) format |
- voc2yolo
Function Description
convert PascalVOC annotation into Yolo.
Parameter |
Default value |
Description |
---|---|---|
dataset_dir |
None |
relative path current folder, or absolute path to the main folder of the image dataset |
voc_ann_dir |
None |
relative path current folder, or absolute path to the main folder of the annotated file. Ex. ‘..data/annotations/’ |
save_dir |
None |
annotation file saving location. Ex. ‘../data/annotations/’ |
- csv2coco
Function Description
convert CSV annotation into COCO.
Parameter |
Default value |
Description |
---|---|---|
dataset_dir |
None |
relative path current folder, or absolute path to the main folder of the image dataset |
csv_ann_dir |
None |
relative path current folder, or absolute path to the main folder of the annotated file. Ex. ‘..data/annotations.csv’ |
save_dir |
None |
annotation file saving location. Ex. ‘../data/annotations.json’ |
center |
True |
defined in the above ‘Note’ |
- csv2voc
Function Description
convert CSV annotation into PascalVOC.
Parameter |
Default value |
Description |
---|---|---|
dataset_dir |
None |
relative path current folder, or absolute path to the main folder of the image dataset |
csv_ann_dir |
None |
relative path current folder, or absolute path to the main folder of the annotated file. Ex. ‘..data/annotations.csv’ |
save_dir |
None |
annotation file saving location. Ex. ‘../data/annotations/’ |
- csv2yolo
Function Description
convert CSV annotation into Yolo.
Parameter |
Default value |
Description |
---|---|---|
dataset_dir |
None |
relative path current folder, or absolute path to the main folder of the image dataset |
csv_ann_dir |
None |
relative path current folder, or absolute path to the main folder of the annotated file. Ex. ‘..data/annotations.csv’ |
save_dir |
None |
annotation file saving location. Ex. ‘../data/annotations/’ |
- csv2multilabel
Function Description
convert CSV (Object Detection)annotation into CSV (Multi-label).
Parameter |
Default value |
Description |
---|---|---|
csv_dir |
None |
relative path current folder, or absolute path to the main folder of the annotated file. Ex. ‘..data/annotations.csv’ |
save_dir |
None |
annotation file saving location. Ex. ‘..data/annotations_m.csv’ |
- yolo2coco
Function Description
convert Yolo annotation into COCO.
- yolo2voc
Function Description
convert Yolo annotation into PascalVOC.
Parameter |
Default value |
Description |
---|---|---|
dataset_dir |
None |
relative path current folder, or absolute path to the main folder of the image dataset |
yolo_ann_dir |
None |
relative path current folder, or absolute path to the main folder of the annotated file. Ex. ‘..data/annotations/’ |
save_dir |
None |
annotation file saving location. Ex. ‘../data/annotations/’ |
- yolo2csv
Function Description
convert Yolo annotation into CSV.
Parameter |
Default value |
Description |
---|---|---|
dataset_dir |
None |
relative path current folder, or absolute path to the main folder of the image dataset |
yolo_ann_dir |
None |
relative path current folder, or absolute path to the main folder of the annotated file. Ex. ‘..data/annotations/’ |
save_dir |
None |
annotation file saving location. Ex. ‘../data/annotations.csv’ |
is_multilabel |
False |
if ‘True’ output will be in CSV (Multi-label) format, else in CSV (Object Detection) format |
Supporting Annotation File Examples
- COCO
{
"annotations": [
{
"id": "1",
"image_id": "1",
"category_id": 1,
"area": 22165,
"bbox": [170, 114, 313, 269],
"ignore": "0",
"iscrowd": "0"
},
.
.
],
"images": [
{
"file_name": "1.jpg",
"height": 413,
"width": 413,
"id": "1"
},
.
.
],
"categories": [
{
"id": 1,
"name": 1,
"supercategory": "none"
},
.
],
}
- PascalVOC
<annotation>
<folder></folder>
<filename>000008_jpg.rf.d00174cb69229a352e8677a640ec2d86.jpg</filename>
<path>000008_jpg.rf.d00174cb69229a352e8677a640ec2d86.jpg</path>
<source>
<database>roboflow.ai</database>
</source>
<size>
<width>416</width>
<height>416</height>
<depth>3</depth>
</size>
<segmented>0</segmented>
<object>
<name>helmet</name>
<pose>Unspecified</pose>
<truncated>0</truncated>
<difficult>0</difficult>
<occluded>0</occluded>
<bndbox>
<xmin>201</xmin>
<xmax>241</xmax>
<ymin>115</ymin>
<ymax>142</ymax>
</bndbox>
</object>
<object>
<name>head</name>
<pose>Unspecified</pose>
<truncated>0</truncated>
<difficult>0</difficult>
<occluded>0</occluded>
<bndbox>
<xmin>128</xmin>
<xmax>164</xmax>
<ymin>151</ymin>
<ymax>180</ymax>
</bndbox>
</object>
</annotation>
- CSV(Object Detection)
filename |
width |
height |
class |
xmin |
ymin |
xmax |
ymax |
---|---|---|---|---|---|---|---|
1.png |
416 |
416 |
helmet |
234 |
136 |
265 |
197 |
1.png |
416 |
416 |
head |
109 |
135 |
145 |
164 |
- CSV(Multi-label)
Description : one-hot encoded format of the all the classes presents in the annotation
filename |
head |
helmet |
---|---|---|
1.png |
1 |
0 |
2.png |
0 |
1 |
- Yolo
Description : YoloV3 annotation format where save .txt file for each image. in each text file, bounding boxes recorded as;
<label> <x-center> <y-center> <width> <height> format.
where all the values are normalized by the image width&height sizes.