Best way to include size information?

Hi there,

I try to classify black/white images of silhouettes (of animal tracks). Size of the footprints matters a lot, so I want to include this extra information. I have a list with scale factors (which tell me how long one pixel is in reality for each image). I see two options now:

  1. I could make a separate layer for the scale factor data, and then concatenate image and scale factor output (which, I think, is possible using functional API instead of sequential model).

  2. I could program a script that puts black scale bars in a standardised position into every image.

Which of those would be the best approach?

Thanks a lot!

Hi @Mahaban,

Welcome to the TensorFlow Forum!

You can try with first approach which is more flexible and scalable than the second approach.
As you mentioned, you can follow below steps to implement this approach in Functional model :

  1. Create a separate layer tf.keras.layers.Dense() for the scale factor data with one output unit.
  2. Concatenate the image and scale factor output using the tf.keras.layers.Concatenate() layer.
  3. Pass the concatenated output to the rest of your model.

Please refer to this TF doc - Models with multiple inputs and outputs for your reference. Thank you