keras-yolo2
keras-yolo2 copied to clipboard
Annotations - Yolo txt to xml format
Is there a script available to convert annotations in the YOLO txt format to the xml format accepted by the code?
The XML format accepted by the code is the Pascal VOC format. I don't know what you mean by the YOLO TXT format.
Personally, I am using the vod-converter to go from the KITTI format (.txt) to the Pascal VOC format (.xml).
@groot-1313 Sorry I don't know of anything. Welcome your contribution if you can find or write one.
I used labelImg which allows to browse through a set of images and create XML annotation files, which work for YOLO: https://github.com/tzutalin/labelImg
@FabianHeinemann do you need to convert .xml files from LabelImg to .txt file which used for yolo?
https://gist.github.com/goodhamgupta/7ca514458d24af980669b8b1c8bcdafd
@FabianHeinemann do you need to convert .xml files from LabelImg to .txt file which used for yolo?
hi I need the other way around, from txt to xml is there such a convertor? thanks
Hello, did you find a solution to transfer from .txt (YOLO format) to XML format?
cat /deepbin/txt2xml
#!/bin/csh -f
set f = $1
set ff = echo $f | cut -d"/" -f2 | sed 's/.txt$//'
echo $ff
if ( ! -e $ff.jpg ) then
echo does not exist
continue
endif
set wh = xli -identify $ff.jpg | cut -d" " -f4 | tr "x" " "
echo $wh
set aoi = cat $f
echo $aoi
if ( "$aoi" == "") continue
set cleft = echo "$aoi[2] * $wh[1]" | bc | sed 's/\..*$//'
set ctop = echo "$aoi[3] * $wh[2]" | bc | sed 's/\..*$//'
set width = echo "$aoi[4] * $wh[1]" | bc| sed 's/\..*$//'
set height = echo "$aoi[5] * $wh[2]" | bc| sed 's/\..*$//'
echo $cleft $ctop $width $height
@ hwidth = ( $width / 2 )
@ hheight = ( $height / 2 )
@ left = $cleft - $hwidth
@ right = $cleft + $hwidth
@ bot = $ctop + $hheight
@ top = $ctop - $hheight
echo $left $right $top $bot
#echo enter to continue
#set i =<$
#1 - roi file name
set roi = echo 0 $left $right $top $bot
set ifn = $ff.jpg
set xfn = $ff.xml
echo ifn $ifn
set w = xli -identify $ifn | cut -d" " -f4 | cut -d"x" -f1
set h = xli -identify $ifn | cut -d" " -f4 | cut -d"x" -f2
echo '
I wrote some csh scripts, maybe above is it
@richardgohth Thank you for your reply, did it work well in translating the Yolo txt format to xml? if yes, then this has to be executed in the cmd for each txt file or where?
yes for each file we no longer need to do this hence this script is not maintained sorry
@nourhanTr @richardgohth I wrote a python program to convert (yolo) .txt annotations to .xml annotations. You can use if you still need it. You can convert all files in a folder at once.
https://github.com/MuhammadAsadJaved/Important-shells/blob/master/README.md#convert-txt-darknet-annotations-to-xml-voc-annotations