Borrar filtros
Borrar filtros

Input shape for image sequence classification

12 visualizaciones (últimos 30 días)
HA
HA el 25 de Mayo de 2021
Comentada: Xie Shipley el 24 de Oct. de 2023
The following link has a sample code for classifying a sequence of images. The networks is built to classify a sequence of 28 by 28 grayscale images. It was not clear fot me the shape of the input data. How does the network "understand" that the sequence in this case consists of one image? What is the shape of the matrix or object holding all images? is it [28 28 1 1 1000] for [height, width, channels, time, number of sequences]?

Respuestas (1)

Tarunbir Gambhir
Tarunbir Gambhir el 17 de Jun. de 2021
In this example, since the task is to create a classification LSTM network that classifies sequences of 28-by-28 grayscale images, the 'sequenceInputLayer' function takes the input size as [28 28 1] for height, width, and number of channels.
The 'sequenceInputLayer' then takes care of interpreting the sequence input of the form H-by-W-by-C-by-S array, where H, W, C, and S are the height, width, number of channels, and number of frames of the video, respectively.
You can refer this example for the full code to classify sequence of RGB images. You can see that the input to the model is read using the helper function 'readVideo' which returns an H-by-W-by-C-by-S array, and the input size to the 'sequenceInputLayer' is given as [inputSize 3] where inputSize is [224 224].
  2 comentarios
HA
HA el 17 de Jun. de 2021
Thank you for your responce.
I figured that I need to create a cell array to hold the image sequences where the cell array is of S-by-1 and each element in that array is an image. However this was not clear to me initially from the examples provided given that I wanted to directly use the images. The video classification examples uses CNN-featues extracted from the images (I thought the cell array is needed just to hold the extracted features and that I can somehow feed a 5D matrix H-W-C-TimeStamp-SeqNum to the sequenceInputLayer).
Xie Shipley
Xie Shipley el 24 de Oct. de 2023
@HA have you tried image sequence classification task on GPU, I got CUDNN_STAT​US_EXECUTI​ON_FAILED ERROR when convolution2dLayer is used, could you help me figure this out?

Iniciar sesión para comentar.

Categorías

Más información sobre Image Data Workflows en Help Center y File Exchange.

Productos


Versión

R2020a

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by