My goal is to design and train a model to detect points of derivative discontinuity in a line profile. The input data of my model are 1D vectors, with some geometrical shapes [as shown in Fig 3], one adjacent to the other and such that their value in these points are (almost) the same. These profiles might be like line-circle, circle-circle, line-line etc.
Since the input vector represents a real measure, everything that is not belonging to the aforementioned profiles is set to be 0. The length of the vector is "length".
So an example of the input might be [0,0,0,0,0,0,0,0, ........, profile1, profile2,..., 0,0,0,0]. (input vectors are normalized)
I want to train my network to point out where the different profiles begin and end.
My idea was to train a network whose output was a 1D vector of dimension "length", where the points of interest are labeled with "1" element (and setting the others as "0), making this a binary classification problem on multiple outputs.
However, during training the accuracy is stuck to a value close to 0.5, regardless of the batch size and learning rates.
Do you have any suggestions?
If that is the case, is there a more suitable design for the network?
My network is:
# Define the neural network model
model = keras.Sequential([
layers.InputLayer(input_shape=(length,)),
layers.Dense(512, activation='relu'),
layers.Dense(2048, activation='relu'),
layers.Dense(length, activation='sigmoid')
# Output layer with 'length' units for probability estimate
])
model.compile(loss='binary_crossentropy', optimizer='adam', metrics=['accuracy'])
# Compile the model
# Train the model
history = model.fit(x_train, y_train, epochs=num_epochs, batch_size=batch)```
[loss behavior with epochs][1]
[accuracy behavior with epochs][2]
[Example of training data vs predicted data: the "x" in the measured profile shows the points I want to predict, while the predicted windows fail to have peaks in these points][3]
[1]: https://i.sstatic.net/DXqSz.png
[2]: https://i.sstatic.net/zzXFF.png
[3]: https://i.sstatic.net/QuN3e.png