-1

I have been trying to train yolov8 instance segmentation model but before that I have to augment data. I could not find any resources for instance segmentation (which is labeled by polygons not mask) about positional augmentation technics such as rotation, flip, scaling and translation because when I use one of these technics, polygons' coordinates also must be changed but I cannot change every coordinate manually since there are a lot of them. Here is a sample .txt file:

1 0.13479262672811063 0.33850182906551374 0.10829493087557607 0.4584718989025607 0.09101382488479264 0.5676754240106417 0.10368663594470048 0.6322746923844363 0.10599078341013828 0.6661124043897573 0.10714285714285715 0.7353259062188228 0.18087557603686638 0.7691636182241437 0.18548387096774197 0.8137678749584303 0.2154377880184332 0.8291486531426672 0.2523041474654378 0.8399151978716328 0.2730414746543779 0.7830063185899568 0.3064516129032258 0.8030013302294645 0.38594470046082946 0.810691719321583 0.41359447004608296 0.8199201862321251 0.44124423963133635 0.8229963418689725 0.47235023041474655 0.8137678749584303 0.4884792626728111 0.763011306950449 0.5357142857142858 0.7660874625872964 0.7188940092165901 0.7460924509477885 0.7350230414746545 0.763011306950449 0.7557603686635946 0.7691636182241437 0.7926267281105992 0.76762554040572 0.8076036866359447 0.7337878284003991 0.8237327188940093 0.7199451280345861 0.8559907834101385 0.7045643498503493 0.8974654377880185 0.6922597273029598 0.9101382488479262 0.6061273694712337 0.8859447004608296 0.2908214166943797 0.5195852534562213 0.16469903558363813 0.24539170506912444 0.21853175922846688 0.2546082949308756 0.2446790821416694 0.20852534562211983 0.3077402726970402

this txt file points to this image:

enter image description here

please give me some informations.

I have tried manually changing coordinates but it was impossible.

Albert Einstein
  • 7,472
  • 8
  • 36
  • 71

1 Answers1

0

You can use built-in yolo augmentation settings if there is no special need for manual dataset augmentation. These settings will be applied with the chosen probability or target range during training, and the polygon coordinates will be changed automatically. You will get a more diverse dataset with this technic compared with manual augmentation since every image has a chance to be augmented in many different ways during the training process. The arguments you need:

  • translate (default is 0.1, image translation (+/- fraction)),
  • scale (default is 0.5, image scale (+/- gain)),
  • degrees (default is 0.0, image rotation (+/- deg)),
  • flipud (default is 0.0, image flip up-down (probability)),
  • fliplr (default is 0.5, image flip left-right (probability)).

More information about YOLOv8 augmentation settings: https://docs.ultralytics.com/usage/cfg/?h=config#augmentation

If you need to augment your data manually, you can try to translate polygons to masks and apply the same augmentations to the image and its mask. Then get polygon coordinates from the augmented mask and use them in yolo label.

hanna_liavoshka
  • 115
  • 1
  • 6