Batch image inpainting with foreground segmentation

Background

  • My set of images are photos of birds in cages - I have some with cage bars in the foreground which I would like to remove, and use generative image inpainting to fill in this area.240_F_375411216_0DvrP1FY39xVjMYSv42Cno1QemWT56Nw

Analysis goals

My analysis goal is to remove the cage bars from my dataset and inpaint to get a more complete picture of the bird - however, I am looking to do this using batch processing somehow - my dataset is quite large (close to 1000 photos)

Challenges

  • I’m currently daunted by some of the larger open source algorithms such as DeepFill v2, my issue being that I have relatively repeating structures in my photos, though some are taken at different angles - so algorithms such as image defencing are more interesting to me, though I can’t find any example code for this in Python - in addition the section to inpaint is already contained within the image
  • I have already tried some of the OpenCV image inpainting methods, which don’t seem to work on my images - I also tried creating masks from annotations made online in the VGG Annotator though it is very difficult to mask the lattice of cage bars in one continuous polygon, so ended up with multiple mask images
  • I was also going to try the GIMP inpainting plug-in but do not have the time to use this for thousands of photos

Any suggestions would be welcome, I’m at a loss of where to start!

You mentioned about image defencing. It looks like the right starting point. I check there are some open-source code on this method such as DefenceNet though it is not in Python. Would this be helping to narrow your experiments?

Hi there,

Thank you so much for your comment- I currently don’t use MatLab and would much rather try any methods in Python, that’s my issue!

There is a candidate repo that you can explore (in Python).

hi there, thank you so much for this! Have you used it? I seem to be having many problems running the code