Yolo_mark
Yolo_mark copied to clipboard
Annotations issue.
I had annotations for 10k images in .xml format I successfully converted them to .txt format but the class number is starting from 1, not from 0. I rechecked some converted annotations in labelImg they are showing the exact class name. Problem is : class numbers in .txt files are from 1, is there any way to correct this? can I train yolo in this case?
What if I have text files in the form class w1 h1 w2 h2 .... and I need new text files in the form path to image w1,h1,w2,h2 .... ,class
How can I automate this process and not write them by hand?
you can create a script to manipulate the content.(hit and trial) otherwise by hand ! but why do you need class label in the end.. thats not how yolo takes input ?
@manish33scss yes I work with keras-yolo3. It says: Generate your own annotation file and class names file. One row for one image Here is an example:
path/to/img1.jpg 50,100,150,200,0 30,50,200,120,3 path/to/img2.jpg 120,300,250,600,2 ...
And I was using some annotator that gave me the text files like class w1 h1 w2 h2 (for every photo new file).
Do you know how the script would look like to automate this process?
I'LL have to look around for that , labelimg gives likes this, you can also work with pytorch that accepts the same annotation files i.e. class wi h1 w2 h2.
import os
path = 'C:\SANDRA\IAESTE PRAKSA DUBAI\SCASS\PYTHON\FINAL PROGRAM\Yolo-Annotation-Tool-New--master\Labels\zaedno'
for filename in os.listdir(path):
with open(os.path.join(path,filename) ,'w+') as f:
for line in f:
linenumber = f.readlines()
i = 0
f.close()
resultnumber = []
for i in linenumber:
columns = i.split(' ')
while len(columns) != 5:
klasa = columns[0]
w1 = columns[1]
h1 = columns[2]
w2 = columns[3]
h2 = columns[4]
os.path.splitext(filename) # 'ime', '.txt'
ime = os.path.splitext(filename)[0] # 'ime'
with open('C:\SANDRA\IAESTE PRAKSA DUBAI\SCASS\PYTHON\FINAL PROGRAM\Yolo-Annotation-Tool-New--master\Labels.txt', 'w') as w:
w.write('C:\SANDRA\IAESTE PRAKSA DUBAI\SCASS\PYTHON\FINAL PROGRAM\Yolo-Annotation-Tool-New--master\Images\zaedno{%s}.jpg {%s},'
'{%s},{%s},{%s},{%s} \n'. format(ime, w1, h1, w2, h2, klasa))
I tried with his but the only thing it does is deleting the info from the text files that I need to change
can you tell me where is my mistake?