小编sou*_*aha的帖子

How to train Siamese network in Keras?

I have a pandas dataframe containing filenames of positive and negative examples as below

img1        img2      y
001.jpg     002.jpg   1 
003.jpg     004.jpg   0 
003.jpg     002.jpg   1  
Run Code Online (Sandbox Code Playgroud)

I want to train my Siamese network using Keras ImageDataGenerator and flow_from_dataframe. How do I set up my training so that the code inputs 2 images with 1 label simultaneously.

Below is the code for my model

def siamese_model(input_shape) :
    left = Input(input_shape)
    right = Input(input_shape)
    model = Sequential()
    model.add(Conv2D(32, (3,3), activation='relu', input_shape=input_shape))
    model.add(BatchNormalization()) …
Run Code Online (Sandbox Code Playgroud)

machine-learning computer-vision deep-learning conv-neural-network keras

5
推荐指数
1
解决办法
924
查看次数