cloftus96 / Synthetic-Data-Generation

13 stars 0 forks source link

Annotate Generated Synthetic Data #11

Open reynoldsp709 opened 5 years ago

reynoldsp709 commented 5 years ago
reynoldsp709 commented 5 years ago

image

reynoldsp709 commented 5 years ago
ColinLeongUDRI commented 5 years ago

Quick point: When actually training a classifier, we'd want to give it images without any boxes drawn on it, so these bounding boxes would not be actually drawn on the generated data.

So long as the pixel coordinates of the corners of the box are included in the accompanying CSV file, we can use that CSV to visualize the boxes later. I've often seen this saved as four numbers: upper-left x, upper-left y, lower-right x, lower-right y. Or just ulx, uly, lrx, lry for short.

ColinLeongUDRI commented 5 years ago

Just recapping some notes from the meeting. It sounds like this can be done by:

  1. Taking a picture with and without the object.
  2. Finding the difference between the two pictures and perhaps using some threshold to generate a binary mask.
  3. Finding "connected groups"
  4. Select the correct connected group or groups (probably by checking number of pixels in groups)
  5. Generate bounding boxes by checking the top-most, left-most, right-most, and bottom-most pixels in the group. Put that info into the truth CSV.
  6. Maybe save off the entire mask separately?

All of the above should be doable in Python, using Scipy, OpenCV, and other libraries.

Difference links: https://www.pyimagesearch.com/2017/06/19/image-difference-with-opencv-and-python/ http://scikit-image.org/docs/dev/api/skimage.measure.html#skimage.measure.compare_ssim https://stackoverflow.com/questions/189943/how-can-i-quantify-difference-between-two-images https://stackoverflow.com/questions/27035672/cv-extract-differences-between-two-images/27036614 http://scipy-lectures.org/advanced/image_processing/

Connected Groups: https://stackoverflow.com/questions/16937158/extracting-connected-objects-from-an-image-in-python https://scipy-lectures.org/packages/scikit-image/auto_examples/plot_labels.html https://stackoverflow.com/questions/46737409/finding-connected-components-in-a-pixel-array