Closed chauhansaurabhb closed 4 years ago
Thanks for the quick response!
As you suggested the link, using that link it writes only rectangle shape to .xml file and skips the other shapes due to this code: if shape['shape_type'] != 'rectangle':
How can I write polygon bounding boxes to .xml file? Is it possible?
you need to modify the script, but that shouldn’t be too hard. you just need to compute bounding box from polygons.
I modified the code but still it draws straight rectangle. For example, I labelled the following image using labelme (Image credits: google images):
I converted it to voc format using the modified labelme2voc.py
script and I got the following output (here we can see that it draws straight rectangle irrespective of orientation that we applied during labeling):
Modified code snippet:
# if shape['shape_type'] != ('rectangle' or 'polygon'):
# print('Skipping shape: label={label}, shape_type={shape_type}'
# .format(**shape))
# continue
class_name = shape['label']
class_id = class_names.index(class_name)
if shape['shape_type'] == 'rectangle':
(xmin, ymin), (xmax, ymax) = shape['points']
elif shape['shape_type'] == 'polygon':
(xmin, ymin),(_,_),(xmax, ymax),(_,_) = shape['points']
# swap if min is larger than max. ```
Could you please guide me?
Ok, so you want to annotate an oriented bounding box. In that case, you need to apply principal axes eg: https://scikit-image.org/docs/dev/auto_examples/segmentation/plot_regionprops.html
Thanks for the kind response. But I looked at the suggested link. In that case, it doesn't generate oriented bounding box. I am at beginner level (I may be wrong). Please feel free to correct me!
The bounding box in the webpage is not oriented, but it should be possible to compute oriented bounding box using the red axes.
On Fri, 10 Jan 2020 at 13:11, Saurabh Chauhan notifications@github.com wrote:
Thanks for the kind response. But I looked at the suggested link. In that case, it doesn't generate oriented bounding box. I am at beginner level (I may be wrong). Please feel free to correct me!
— You are receiving this because you were assigned.
Reply to this email directly, view it on GitHub https://github.com/wkentaro/labelme/issues/542?email_source=notifications&email_token=ABA4LE75JPL4YGSPJMOHZVTQ5BXZFA5CNFSM4KEJJI62YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEIT32NI#issuecomment-573029685, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABA4LEZ6RVCFALSW2IF66YTQ5BXZFANCNFSM4KEJJI6Q .
-- Kentaro Wada / 和田 健太郎 https://wkentaro.com http://wkentaro.com
Thanks for the pointer. Let me try!
Hi, i have this problem...in the folder AnnotationsVisulization
RectLabel is an offline image annotation tool for object detection and segmentation. Although this is not an open source program, with RectLabel you can label oriented bounding boxes using polygons and rotated boxes. You can export/import the Labelme JSON format.
<annotation>
<folder>test_all_1</folder>
<filename>victor-zh-9-t1wSdkpbo-unsplash.jpg</filename>
<size>
<width>4000</width>
<height>2250</height>
<depth>3</depth>
</size>
<object>
<name>boat</name>
<pose>Unspecified</pose>
<truncated>0</truncated>
<occluded>0</occluded>
<difficult>0</difficult>
<polygon>
<x1>2936.429199</x1>
<y1>1144.979248</y1>
<x2>2936.052490</x2>
<y2>1084.907593</y2>
<x3>3128.331787</x3>
<y3>1082.977539</y3>
<x4>3129.029785</x4>
<y4>1144.006470</y4>
</polygon>
<bndbox>
<xmin>2936.052490</xmin>
<ymin>1082.977539</ymin>
<xmax>3129.029785</xmax>
<ymax>1144.979248</ymax>
</bndbox>
</object>
</annotation>
Hello,
I was used to labelimg tool but I noticed that labelimg tool is not suitable when object is not straight forward and labelimg doesn't allow to rotate bounding box.
Thanks for sharing this tool. This tool generates .json file as output but for object detection using tensorflow, I need Pascal VOC format output file i.e. .xml file.
Is it possible to get bounding box and label related information in .xml file i.e. Pascal VOC format?
Thank you!