qqwweee / keras-yolo3

A Keras implementation of YOLOv3 (Tensorflow backend)
MIT License
7.14k stars 3.45k forks source link

How to get the annotation format mentioned in the README.md? #520

Open YZAlex opened 5 years ago

YZAlex commented 5 years ago

we can use labelImg tool to generate xml annotation files, but how to get the annotation file mentioned in the README.md : path/to/img1.jpg 150,200,130,250,0 110,250,165,145,1
can anybody teach me the method , thanks a lot......

yuki4ghub15 commented 5 years ago

You need to make a python script to convert image path and label from xml to yolo-keras format.

bluesy7585 commented 5 years ago

I added one script to do this. here python convert_voc_annotation.py -t .\data\Annotations -i .\data\JPEGImages give it folder path to xml files and images. it outputs train.txt which contains the required annotations.

if you are not using voc dataset, you need to change those class names in the code. e.g. "aeroplane", "bicycle" etc...

YZAlex commented 5 years ago

I added one script to do this. here python convert_voc_annotation.py -t .\data\Annotations -i .\data\JPEGImages give it folder path to xml files and images. it outputs train.txt which contains the required annotations.

if you are not using voc dataset, you need to change those class names in the code. e.g. "aeroplane", "bicycle" etc...

Thank you for sharing your script, it's helpful @bluesy7585

YZAlex commented 5 years ago

You need to make a python script to convert image path and label from xml to yolo-keras format.

Thanks a lot @yuki4ghub15

jwnirvana commented 5 years ago

I added one script to do this. here python convert_voc_annotation.py -t .\data\Annotations -i .\data\JPEGImages give it folder path to xml files and images. it outputs train.txt which contains the required annotations.

if you are not using voc dataset, you need to change those class names in the code. e.g. "aeroplane", "bicycle" etc...

Nice. Could you please tell me how much the line number of trian_annotation.txt?

sandramateska commented 5 years ago

I have made a text file for the anchor boxes which looks like this: C:\path\00000002.jpg 0.33999999999999997,0.6900000000000001,0.7225,0.26,1 0.7775,0.40249999999999997,0.91,0.265,1 0.68,0.97,0.84,0.8025,1 .. (path x1,y1,x2,y2,class) I have made it by myself with converting the form from txt file which was like this: (class x y width height) *Used a different annotator

Now when I try to run the train.py and put the path to my txt file for my anchors, classes,the path to my foldaer with the photos and the output folder its gives me ERROR : Using TensorFlow backend. 2019-11-13 08:17:06.054804: I C:\tf_jenkins\workspace\rel-win\M\windows\PY\36\tensorflow\core\platform\cpu_feature_guard.cc:140] Your CPU supports instructions that this TensorFlow binary was not compiled to use: AVX2 ................................. Traceback (most recent call last): File "train.py", line 190, in _main() File "train.py", line 42, in _main with open(annotation_path) as f: FileNotFoundError: [Errno 2] No such file or directory: 'train.txt'

What should I do ?

bfialkoff commented 4 years ago

Just replace train.txt with the path to the annotation file...