-
Notifications
You must be signed in to change notification settings - Fork 3.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Feature/pascal voc converter #9
Feature/pascal voc converter #9
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
Could you please add yourself into CONTRIBUTORS.md? If you don't want to do that it is fine.
cvat/scripts/pascal_voc.py
Outdated
from pascal_voc_writer import Writer | ||
|
||
|
||
def process_cvat_xml(xml_file, img_dir, annotation_dir): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@syonekura, Thank you for the MR! I see that the script supports only "annotation" format and doesn't support "interpolation" format. What is the reason for that?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As I understand from XML Format, the interpolation format doesn't have a image file for each object (is a per video annotation), and it doesn't declare the path of the video file.
I'm not sure if this script should create not only the VOC XML's but also the image files from the video. If it should create them, is there an easy way to get the path of the video, or query for a specific frame of the task? If it shouldn't create the image files (for example if CVAT already let you download the interpolations as images), I still need the 'path' of those future images, is there a way to query the map between the frame number and the image filename?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please be sure that the script will handle unsupported annotation files (like for interpolation) gracefully.
cvat/scripts/pascal_voc.py
Outdated
@@ -0,0 +1,42 @@ | |||
import os |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The script is very nice. Probably it will be very convenient for other users to have a short description what it does and an example how to run it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should that description go above the imports or in the description argument of argparser?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Above imports. Also what is the license for you script? MIT?
cvat/scripts/pascal_voc.py
Outdated
|
||
writer = Writer(filepath, width, height) | ||
|
||
for box in img_tag.findall('box'): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Soon we are going to add polygons, polylines, points. What is your proposal? To convert them to bounding boxes or ignore?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
At first I would ignore and warn, after if we find some clever ways to convert those geometries into bounding boxes we could add a parameter for the user to choose (from the top of my head I guess an application of convex hull and obtain min/max coordinates would work), but in my opinion that should be another feature proposal
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OK
cvat/requirements/base.txt
Outdated
@@ -22,3 +22,4 @@ scipy==1.0.1 | |||
sqlparse==0.2.4 | |||
django-sendfile==0.3.11 | |||
dj-pagination==2.3.2 | |||
pascal-voc-writer==0.1.4 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What do you think if we have separate requirements.txt file for scripts directory? Does it make sense?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I guess it depends on the amount of scripts that CVAT will have and how does the requirements grow for each one, if there will be already two scripts (coco and pascal) and each one has their own requirements, it may be a good idea to split them from the base. Should I move the requirement to a new cvat/requirements/scripts.txt
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Current internal branch has the following structure:
cvat/utils/
convert_to_coco.py
convert_to_mask.py
doc/
convert_to_coco.md
convert_to_mask.md
README.md
requirements.txt
CONTRIBUTORS.md
Outdated
@@ -18,5 +18,6 @@ | |||
# Contributors | |||
|
|||
- **[Victor Salimonov](https://github.com/VikTorSalimonov)** | |||
- **[Sebastián Yonekura](https://github.com/syonekura)** |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Victor did documentation and screen casts. I expect to see:
- **[Sebastián Yonekura](https://github.com/syonekura)**
* [convert_to_voc.py](utils/convert_to_voc.py) - an utility for converting CVAT XML to PASCAL VOC data annotation format.
Please rebase your changes otherwise to many commits from origin/master in the diff. I hope to merge your contributions soon. Please notify me when you are ready. Thank you! |
…otations different than bounding boxes
55b2cd1
to
52d2149
Compare
@nmanovic I think we're ready, I added the warnings for the interpolation format and the unsupported geometries |
Fixes #2
Adds a simple script to transform CVAT XML output to PASCAL VOC format