That is a very nice question! Simple enough to communicate clearly, yet it entails a number of interesting things and provides an opportunity for AI/ML thinking…
Here’s an experiment you could try in PL - i.e. yes, I think you can do this and learn a lot from it in PL!
- Create a number of image pairs - one image containing a circle - in a random location, with random size, colour etc. and anothe containing a square centered in the same place as the circle, with the same colour and size… side of square = diameter of circle? (you can program image generation any way you like… but developing your python skills wouldn’t hurt since most ML is done in python)
- Create as many as you can, but at least 1,000, and maybe, use a power of 2, i.e. 1024, 4096, 65536… as batch sizes are usually in powers of two
- Don’t make the images too big 256x256 would be more than enough to begin with I think
- Create a CSV file that specifies the circle images as input and the square images as target, then create a PL model from this
Now, what goes between the input and the target you can vary later (once PL has created a basic model for you), by looking at examples here and elsewhere, bearing in mind that the most basic idea of ML we can apply here is that training in this case comprises (very, very loosely!) comparing the input to the to the target (the “forward pass”) and passing back through the layers between the target and the input adjustments to the weights and biases that will progressively reduce the error (“back propagation”).
Once your network has been trained, in principle it would take a circle as input and “predict” the corresponding square from it.
Now, using your model to make new “predictions” currently requires some additional work but @robertl has provided some example scripts, and @birdstream has already done this for one of his models so there are people who can help with that too.
Beyond this most basic example, you could consider what happens if the circle is not entirely in the image, what orientation should the squares have - could you make it depend on colour, for example?
You will need only a python installation - but if your PC has nVidia graphics and you can use CUDA that will speed things up.
Don’t hesitate to share your progress or ask for more input!