Comments (3)
Taking an example from Detectron2, I added a polygon friendly version of your "convert_to_coco" function by making some minor changes to the bounding box loop:
for bbox in bboxes:
category_name = bbox['polygonlabels'][0]
if category_name not in category_name_to_id:
category_id = len(categories)
category_name_to_id[category_name] = category_id
categories.append({
'id': category_id,
'name': category_name
})
category_id = category_name_to_id[category_name]
annotation_id = len(annotations)
**poly = [(x + 0.5, y + 0.5) for x, y in bbox['points']]
pxpy = np.array(poly)
poly = [p for x in poly for p in x]
annotations.append({
'id': annotation_id,
'image_id': image_id,
'category_id': category_id,
'segmentation': [poly],
'bbox': [np.min(pxpy[:,0]), np.min(pxpy[:,1]), np.max(pxpy[:,0]), np.max(pxpy[:,1])],
'ignore': 0,
'iscrowd': 0
})**
Note, that I changed the bbox boundaries to absolute coords and imported numpy. It runs but I still need to check if the output works with a model.
from label-studio-converter.
from label-studio-converter.
@loomcode ,
This functionality has been added since label-studio>=0.7.5
. Can you try it out and close an issue if everything is OK ?
from label-studio-converter.
Related Issues (20)
- Export annotations into Oriented Box Bounding. HOT 2
- can you add labelme JSON for annotation format? HOT 1
- Export to Pascal VOC XML is not working. HOT 1
- Is it possible to convert texts containing relations annotated in Label Studio into a Spacy binary file format ?
- Export polygons as PNG mask
- Python directions in README are wrong HOT 1
- YOLO, COCO export error
- Are there any Plans to support Object Tracking formats?
- Export of OCR task into COCO and YOLO doesn't work HOT 2
- Export to YOLO format for Video Annotation Doesn't work.
- Export columns selection
- What is the correct way to convert bbox from label studio to LayoutLMv3Processor bbox format?
- Oriented Bounding Box HOT 1
- RectangleLabels : x,y values inconsistent HOT 1
- YOLO import to LS doesnt import labels HOT 2
- The iter_from_dir that uses`json.load` in method convert_to_voc does not open the json file.
- bug in "iter_from_json_file" method
- export to yolov8 format HOT 5
- CONLL Conversion drops NER labels from token classification
- How to make YOLO RAW tag output format be converted to pre-annotated
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from label-studio-converter.