3
$\begingroup$

I am trying to design and train a neural network, which would be able to give me coordinates of certain key points in the image.

Dataset

I've got a dataset containing 1800 images similar to these:

enter image description here enter image description here

This dataset is generated by me. Each image contains two circles, one smaller and one bigger, generated randomly in the image. My goal is to train the neural network to return 2 sets of coordinates, each of them pointing precisely at the center of the circle. Each image has the shape (320, 320, 1).

Current model

I've been successful to do so to some degree, but it's not good enough. Below, you can see the neural net architecture I've been most successful so far. I use Python, Tensorflow 2 including Keras. I use Adam optimizer, MeanSquaredError loss and RootMeanSquaredError as a metric.

enter image description here

The current result looks as follows. The coordinates that the neural net gave me are drawn in the image.

enter image description here enter image description here

As you can see from the first image, the result is quite precise that I am almost satisfied with. But the average result looks like as in the second image, which is not good at all.

I have trained this model for 35 epochs in a total of 4 runs and it is not able to learn any further as you can see from the Tensorboard.

enter image description here enter image description here

I have tried many different variations of the architecture and tuned hyperparameters. I am not satisfied with the result I got so far. I plan to continue on detecting keypoints from images on more complex datasets and that is the reason why I'm trying to make some progress on much simpler datasets first and add complexity gradually.

I would appreciate any advice you can give me on the model architecture that I would have better results with or maybe a different approach. Tell me if you need to know more implementation details.

Thanks

Edit: To complete the details, Conv2D layers use leaky relu activation function and both dense layers use the sigmoid activation function.

$\endgroup$
  • $\begingroup$ Having coordinates as an output seems to be a regression task. Using sigmoid activation in the Dense layers will distort the performance. Instead have a linear activation function in the last layer. $\endgroup$ – Shubham Panchal Jan 25 at 7:17
  • $\begingroup$ @ShubhamPanchal I have tried that and it is not performing any better. But thanks for the tip. It seems to me that the loss might be too low for the network to learn further. $\endgroup$ – Ladislav Ondris Jan 25 at 14:56
  • $\begingroup$ Did you try transfer learning with keras.applications.mobilenet and pretrained weights? $\endgroup$ – Andrey Rubshtein Jan 27 at 18:45
0
$\begingroup$

You could train YOLO to detect and create bounding box around the circle and then calculate its center. Or even segmentation could help you do this precisely.

| improve this answer | |
$\endgroup$
0
$\begingroup$

My guess is that you wouldn't need machine learning to do that. Adesh Gautam suggested to create bounding box then apply an ML model. I will sugest more thant that : just use a bounding box algorithm. There are a lot of computer vision techniques that can be applied before resorting to ML. I would suggest you to also look at hedge detection.

| improve this answer | |
$\endgroup$
  • 1
    $\begingroup$ Thank you for the suggestion. The reason I resorted to Neural Network is because I am going to do hand keypoint detection and in that particular case I will have to create the bounding box around the hand and then find the keypoints of the hand just like in the question posted. $\endgroup$ – Ladislav Ondris Feb 25 at 22:44

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.