Crop image but still mapping annotation #35
-
Hi @ashnair1 , |
Beta Was this translation helpful? Give feedback.
Replies: 9 comments 14 replies
-
I'm not sure what you mean by annotation mapping. Is the annotation made at the large image level? So for example, you have one large image and one annotation file and you want to know how to tile it in order to make it a COCO style dataset? |
Beta Was this translation helpful? Give feedback.
-
I already have the label file of the large image. I want it when I cut it into small pictures. These small pictures are automatically labeled in the COCO format. @ashnair1 |
Beta Was this translation helpful? Give feedback.
-
What format is the label file? It seems you're working on geospatial imagery so I'm assuming your image is a GeoTIFF and label file is a GeoJSON/Shapefile. Is that correct? |
Beta Was this translation helpful? Give feedback.
-
I'm working on large image sizes of solar panels. I label them with |
Beta Was this translation helpful? Give feedback.
-
Since the size image is too large, I want to cut it into small sheets. These small photos, after being cut, must automatically be labeled in the |
Beta Was this translation helpful? Give feedback.
-
My class: [{'supercategory': 'Dust1', 'id': 0, 'name': 'Dust1'}, {'supercategory': 'Dust2', 'id': 1, 'name': 'Dust2'}, {'supercategory': 'Dust3', 'id': 2, 'name': 'Dust3'}, {'supercategory': 'Wire', 'id': 3, 'name': 'Wire'}]. I don't have class 'supercategory': 'Background' |
Beta Was this translation helpful? Give feedback.
-
Hi @ashnair1,
Why |
Beta Was this translation helpful? Give feedback.
-
I removed parameter |
Beta Was this translation helpful? Give feedback.
-
@winter2897 you can use https://github.com/obss/sahi library for cropping coco annotations and images.
from sahi.slicing import slice_coco
coco_dict, coco_path = slice_coco(
coco_annotation_file_path=coco_annotation_file_path,
image_dir=image_dir,
slice_height=256,
slice_width=256,
overlap_height_ratio=0.2,
overlap_width_ratio=0.2,
) |
Beta Was this translation helpful? Give feedback.
I removed parameter
1
from(len(cats) + 1, 3)
, the result showed that the labelDust1
was the same color as Backgound. The other labels are still correctly illustrated.