We have an greyscale image. Each pixel represents the intensity in range 0 - 255. This intensity can be linearly remapped to value M in different range (e.g. 20 - 50). The image contains some object and we need to find the value M of the pixel with maximum intensity in this object (later, the task will be extended to something like "max + k * average").

The current approach: We have SqueezeNet-SSD that was fed up with 2500 images (+a lot of augmented images) labelled with the object class. When the object is detected, we just go pixel by pixel in its bounding box, find the maximum and remap it to the value M. This approach works correctly but we would like to solve whole task just with one network that will return the expected value M.

Experiment: We tried several regression networks in Keras (those who can be found in several tutorials and also SqueezeNet found on GitHub). The network was fed up with 2500 images. Each images got assigned the expected value M.

model = Sequential([
  layers.Rescaling(1./255, input_shape=(height, width, depth)),
  layers.Conv2D(16, 3, padding='same', activation='relu'),
  layers.Conv2D(32, 3, padding='same', activation='relu'),
  layers.Conv2D(64, 3, padding='same', activation='relu'),
  layers.Conv2D(128, 3, padding='same', activation='relu'),
  layers.Dense(256, activation='relu'),

opt = tf.keras.optimizers.Adam(learning_rate=1e-3, decay=1e-3 / 2000)
model.compile(loss='mean_absolute_error', optimizer=opt, metrics=['accuracy'])   
model.fit(x_train, y_train, epochs=2000, batch_size=512, validation_split=0.2, verbose=1)

The final loss is about 0.15, validation loss about 0.29. The returned value is in expected range 20 - 50, but it does not correspond to the expected value. The error is quite large.

My question is if this problem is solvable by neural network.


Your Answer

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

Browse other questions tagged or ask your own question.