How to Restore Original Mask from Overlayed Image Using CNN?

Joined
Oct 29, 2023
Messages
1
Reaction score
0
I have a 120x120 mask generated from a seed, which is then tiled and overlayed onto a 1920x1080 screenshot. My goal is to use a CNN to reverse this operation and restore the original mask from the overlayed image. I've tried using a simple CNN architecture but it's not working as expected.

Code:
# My CNN architecture
model = models.Sequential()
model.add(layers.Input(shape=(None, None,
model.add(layers.Conv2D(32, (3, 3), activation='relu'))
model.add(layers.MaxPooling2D((2, 2)))
model.add(layers.Conv2D(64, (3, 3), activation='relu'))
model.add(layers.MaxPooling2D((2, 2)))
model.add(layers.Conv2D(128, (3, 3), activation='relu'))
model.add(layers.GlobalAveragePooling2D())
model.add(layers.Dense(512, activation='relu'))
model.add(layers.Dense(120*120*3, activation='linear'))
model.add(layers.Reshape((120, 120, 3)))

model.compile(optimizer='adam', loss='mse')

I have also prepared the dataset, but the CNN isn't producing results close to the original mask. It's not a case of overfitting because I've tried reducing epochs and altering the dataset. After Alterting there was no even remotely close result.

Questions:

What could be wrong with my current approach?

Is the U-Net architecture more suited for this type of problem?

I'm training my model on an NVIDIA RTX 4090. Considering the computational power I have, how can I appropriately increase the number of layers or the sizes of the convolutional layers in my existing architecture to potentially improve performance?

Any better approach to the problem?

Any literature or resources to better understand the problem?

P.S. Idea was taken from this article , second neural network (first D decoder)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,582
Members
45,062
Latest member
OrderKetozenseACV

Latest Threads

Top