简体   繁体   English

卷积神经网络(CNN)可以用于无监督学习中的特征提取吗?

[英]Can convolutional neural network (CNN) be used for feature extraction in unsupervised learning?

I'm doing a side project to learn AI with ANN, I thought of making an unsupervised model that extracts features of each frame on a video to compare them in the future and detect image repetitions.我正在做一个用 ANN 学习 AI 的辅助项目,我想制作一个无监督的 model,它可以提取视频中每一帧的特征,以便将来比较它们并检测图像重复。

My idea is to use a CNN to extract for each frame the features but I can't seem to make it work, as I am learning my intuition tells me that there is something I am just not understanding.我的想法是使用 CNN 为每一帧提取特征,但我似乎无法让它发挥作用,因为我正在学习我的直觉告诉我有些东西我只是不理解。

How can I create an unsupervised model that extracts features of an array of images?如何创建一个无监督的 model 来提取图像数组的特征?

This is what I got:这就是我得到的:

img = load_image_func(???) # this loads a video and return a reshaped ordered list of frames 

input_shape = (150, 150, 3)

# The model
model = Sequential()
model.add(Conv2D(32, (3, 3), activation='relu', padding='same', name='conv_1', input_shape=input_shape))
model.add(MaxPooling2D((2, 2), name='maxpool_1'))
model.add(Conv2D(64, (3, 3), activation='relu', padding='same', name='conv_2'))
model.add(MaxPooling2D((2, 2), name='maxpool_2'))
model.add(Conv2D(128, (3, 3), activation='relu', padding='same', name='conv_3'))
model.add(MaxPooling2D((2, 2), name='maxpool_3'))
model.add(Conv2D(128, (3, 3), activation='relu', padding='same', name='conv_4'))
model.add(MaxPooling2D((2, 2), name='maxpool_4'))
model.add(Flatten())
model.add(Dropout(0.5))
model.add(Dense(512, activation='relu', name='dense_1'))
model.add(Dense(128, activation='relu', name='dense_2'))
model.add(Dense(67500, activation='sigmoid', name='output'))

optimizer=keras.optimizers.Adam(learning_rate=0.001)

model.compile(loss = 'sparse_categorical_crossentropy', optimizer= optimizer, metrics=['accuracy'])

#model.summary()

model.fit(vidcap, vidcap, batch_size=64, epochs=20)

I have the feeling I should be training the model but as it is unsupervised I don't have train data.我觉得我应该训练 model 但由于它是无人监督的,我没有训练数据。

Also, how many units should I put in the output layer as I don't how many features will be detected?另外,我应该在 output 层中放入多少个单元,因为我没有检测到多少特征?

Thanks for your time谢谢你的时间

Indeed, the CNN model will extract several features of an Image (eg colors, shapes, edges, patterns, etc.)实际上,CNN model 将提取图像的几个特征(例如 colors、形状、边缘、图案等)

However , what are you defining as Images Repetition?但是,您将什么定义为图像重复? Are you looking for an algorithm that finds similar images?您是否正在寻找一种可以找到相似图像的算法? If this is the case, then You might wanna look into Siamese Networks , which is exactly what they do: https://www.cs.cmu.edu/~rsalakhu/papers/oneshot1.pdf如果是这种情况,那么您可能想查看Siamese Networks ,这正是他们所做的: https://www.cs.cmu.edu/~rsalakhu/papers/oneshot1.pdf

The main idea here is that there are 2 Neural Networks that are trained together, Then, after the training is done.这里的主要思想是,有 2 个神经网络一起训练,然后,训练完成后。 You use both neural networks to extract features of the same images seperately and compare the results to find the similarity.您使用两个神经网络分别提取相同图像的特征并比较结果以找到相似性。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM