Code Monkey home page Code Monkey logo

voc2coco's Introduction

Quick start

Then you can run the voc2coco.py script to generate a COCO data formatted JSON file for you.

python voc2coco.py ./data/VOC/Annotations ./data/coco/output.json

Then you can run the following Jupyter notebook to visualize the coco annotations. COCO_Image_Viewer.ipynb

Further instruction on how to create your own datasets, read the tutorial.

voc2coco's People

Contributors

tony607 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

voc2coco's Issues

[BUG] Float coordinate cause error (ValueError: invalid literal for int() with base 10)

Float in the coordinate will cause error:

Traceback (most recent call last):
  File "voc2coco.py", line 154, in <module>
    convert(xml_files, args.json_file)
  File "voc2coco.py", line 109, in convert
    ymin = int(get_and_check(bndbox, "ymin", 1).text) - 1
ValueError: invalid literal for int() with base 10: '281.70000076293945'

Code:

voc2coco/voc2coco.py

Lines 108 to 111 in 207f265

xmin = int(get_and_check(bndbox, "xmin", 1).text) - 1
ymin = int(get_and_check(bndbox, "ymin", 1).text) - 1
xmax = int(get_and_check(bndbox, "xmax", 1).text)
ymax = int(get_and_check(bndbox, "ymax", 1).text)

Not sure:

  • it is a general problem or not
  • why there are float in my VOC2012 dataset

Check float in xml files:

grep '<ymin>[0-9].*\.' $VOC_PATH/Annotations/*.xml | head
# In general
grep '<[xy]m[ia][nx]>[0-9]\{0,4\}\.'  $VOC_PATH/Annotations/*.xml | head

Result:

$VOC_PATH/Annotations/2011_003353.xml:			<ymin>45.70000076293945</ymin>
$VOC_PATH/Annotations/2011_006777.xml:			<ymin>281.70000076293945</ymin>

BTW: Great code and blogs! It helps me a lot!

ID

Hello,with your code, I transfer VOC to COCO, but the category id is the last four integers of the filename, please tell how to make it as 0-19 or 1-20

filename issue

Number of xml files: 3000
Traceback (most recent call last):
File "E:/voc2coco-master/voc2coco.py", line 157, in
convert(xml_files, json_file)
File "E:/voc2coco-master/voc2coco.py", line 83, in convert
filename = get_and_check(root, "filename", 1).text
File "E:/voc2coco-master/voc2coco.py", line 29, in get_and_check
raise ValueError("Can not find %s in %s." % (name, root.tag))
ValueError: Can not find filename in annotation.

coco annotation file

hello
i am going to retrain yolov3 with downsampled coco images. but i don't know how can i change the annotation file of coco dataset which is in .json format for this end. would you please tell me how can i change the annotation file?
thank you.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.