POV-Ray : Newsgroups : povray.binaries.images : Synthetic data sets for image analysis : Synthetic data sets for image analysis Server Time
19 Apr 2024 11:43:44 EDT (-0400)
  Synthetic data sets for image analysis  
From: BayashiPascal
Date: 27 Jan 2019 01:45:00
Message: <web.5c4d52ac5c0b0917ce2d55280@news.povray.org>
Hi everyone,

I came up a few days ago with some (maybe?) unconventional way to use POV-Ray
for my job and would like to introduce it here in case it would be of any
interest to someone else.
I was looking for data sets of images to test machine learning algorithms and
couldn't find any one that fit my needs. Then I started thinking of how I could
generate automatically my own data sets. Of course, speaking of synthesis
picture, I immediately thought of POV-Ray, and it worked perfectly for me.
The problem here is not that much the generation of the image itself, but the
generation of its mask. For example, in the example pictures below, the target
is the cube, so I needed to generate automatically the image of the cube *and*
its duplicate where every pixels matching the cube are black and all the others
are white. I found that I could achieve this using the two textures below, one
for the target, and one for everything else.

#declare _texMaskTarget = texture {
  pigment { color Black }
  finish { ambient 0 }
}
#declare _texMaskNonTarget = texture {
  pigment { color White }
  finish { ambient 1 diffuse 100 }
}

Crafting the scene to my needs, adding randomness on the desired variable
components of the scene, using the clock variable as the seed for the random
generator, wrapping that in a Python script which generates and executes an INI
file including the directive Declare=Mask=0 to switch between the normal texture
and the mask texture, and I had a very handy tool to generate in minutes a data
set of hundred of samples crafted to match perfectly any needed test case.

If anyone has a better idea than my trick with the textures to generate the mask
I would be glad to hear it.

For those interested, everything is available on GitHub here:
https://github.com/BayashiPascal/SDSIA


Post a reply to this message


Attachments:
Download 'sdsia.jpg' (83 KB)

Preview of image 'sdsia.jpg'
sdsia.jpg


 

Copyright 2003-2023 Persistence of Vision Raytracer Pty. Ltd.