Giter VIP home page Giter VIP logo

tutorial-image-and-multiple-bounding-boxes-augmentation-for-deep-learning-in-4-steps's People

Contributors

asetkn avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

tutorial-image-and-multiple-bounding-boxes-augmentation-for-deep-learning-in-4-steps's Issues

Need to make more augmentations

Hello when I run the script once despite the fact that I have delete the restriction of doing only 2 random augmentation one the dataset and the bounding boxes when I use the image_aug function only 100 images are saved which are the ones that the dataset has. How can I make the 100 augmented images 200 or even 300. Also when I use the image_aug for my df I use the labels_df becasue my images don't need to be resized don't know if that little thing is the problem.
Thanks in advance for your help

Conflict when using multiple classes in any image

I'm putting this here mostly so people can avoid this difficult to spot issue in the future.

When using this method of augmenting a dataset where images in the dataset can contain bounding boxes of different classes, it is possible that the classes in the resulting dataframe will be invalid. This is caused by the augmentation process when removing bboxes using .remove_out_of_image(). Since there is no link between the rows in the main dataframe and bbs_aug, using remove_out_of_image() can delete a bounding box from bbs_aug however it does not update the rows in the main dataframe to reflect this change. Thus when you bring the newly augmented bboxes back into the main dataframe, some of the rows may be shifted up but only for the positional values of the bboxes and not for any of the remaining columns of the dataframe.

To fix this, you need to somehow link the dataframe and the bbox augmentation arrays and remove any rows in the dataframe that contain bounding boxes that are removed using remove_out_of_image().

CSV file to XML

Hello, How can the content of the csv file be converted back to separate xml files including the augmented bboxes?

bbs_a AssertionError in [25]

Hello,
I experience an issue when running the almost last code in [25] of your notebook. I could not fix it yet. Still, very impressive Augmentation Code!

AssertionError                            Traceback (most recent call last)
<ipython-input-29-32529b912587> in <module>()
     16     bb_a_array = group_a_df.drop(['filename', 'width', 'height', 'class'], axis=1).values
     17     augmented_img = imageio.imread('aug_dataset/'+'aug1_'+filename)
---> 18     bbs_a = BoundingBoxesOnImage.from_xyxy_array(bb_a_array, shape=augmented_img.shape)
     19 
     20     ia.imshow(np.hstack([

3 frames
/usr/local/lib/python3.6/dist-packages/imgaug/augmentables/bbs.py in from_xyxy_array(cls, xyxy, shape)
    923         ia.do_assert(xyxy.shape[1] == 4, "Expected input array of shape (N, 4), got shape %s." % (xyxy.shape,))
    924 
--> 925         boxes = [BoundingBox(*row) for row in xyxy]
    926 
    927         return cls(boxes, shape)

/usr/local/lib/python3.6/dist-packages/imgaug/augmentables/bbs.py in <listcomp>(.0)
    923         ia.do_assert(xyxy.shape[1] == 4, "Expected input array of shape (N, 4), got shape %s." % (xyxy.shape,))
    924 
--> 925         boxes = [BoundingBox(*row) for row in xyxy]
    926 
    927         return cls(boxes, shape)

/usr/local/lib/python3.6/dist-packages/imgaug/augmentables/bbs.py in __init__(self, x1, y1, x2, y2, label)
     45         if x1 > x2:
     46             x2, x1 = x1, x2
---> 47         ia.do_assert(x2 >= x1)
     48         if y1 > y2:
     49             y2, y1 = y1, y2

/usr/local/lib/python3.6/dist-packages/imgaug/imgaug.py in do_assert(condition, message)
   1867     """
   1868     if not condition:
-> 1869         raise AssertionError(str(message))
   1870 
   1871 

AssertionError: Assertion failed.

Converting all_labels.csv to YOLOv3 format

Actually not an issue, but maybe you can help me out in this.

I need the label information for YOLO training. For each image, there is a separate txt file containing the location of the bbox. For the training, I need the following order:

class_number x_center y_center width_bbox height_bbox

The values are not absolute, but rational to the width and height.
For example:

0 0.50 0.50 0.15 0.15

This example means the x_min and y_min are in the center of the image.
width and height are 0.15 of the image, however, if the width differs from height (f.e. 600x450), the bbox is not a square, but a rectangle.

At the end, the dataset in the directory for YOLO-training contains following:

ABC.jpg
ABC.txt
DEF.jpg
DEF.txt
...

Do you know how I can solve the convertion to YOLO format with using python?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.