How to solve the error generated while defining custom FFT layer?

2 visualizaciones (últimos 30 días)
Nasrin
Nasrin el 25 de Feb. de 2025
Editada: Matt J el 2 de Mzo. de 2025
Hello
I was trying to create a custom FFT layer but I'm getting errors, either 'cell' data type related as in 'brace indexing isn't supported' or 'data type isn't supported'. The custom layer is followed by a 2d CNN and defined after the imageinputlayer. I have used imagedatastore to keep my training data. The class definition code is attached. I'm getting error for line 55 but I have tried to resolve that and then I get the data type related error.
Thanks in advance.
  1 comentario
Matt J
Matt J el 25 de Feb. de 2025
Editada: Matt J el 25 de Feb. de 2025
Please provide code and input data (as compact as possible) to reproduce the error.

Iniciar sesión para comentar.

Respuesta aceptada

Matt J
Matt J el 25 de Feb. de 2025
Editada: Matt J el 25 de Feb. de 2025
Your predict() method is written to expect that the input X will be a cell array. It's not clear why you expect this, but you shouldn't. The input given to the layers will always be either regular numeric arrays or dlarrays. The outputs need to be likewise.
It is also not entirely clear why you don't use a functionLayer to implement this, rather than a custom layer. You don't appear to be providing a custom backward or forward method, so a custom layer doesn't seem necessary.
  4 comentarios
Nasrin
Nasrin el 2 de Mzo. de 2025
Yes, it worked. Thanks. But I'm still getting an error using 'trainnet' which I think is due to dimension mismatch during minibatch processing. Should I use a custom training loop? I'm attaching the error snippet here.
Matt J
Matt J el 2 de Mzo. de 2025
Editada: Matt J el 2 de Mzo. de 2025
I doubt that error is coming from the fft code.

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

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

Community Treasure Hunt

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

Start Hunting!

Translated by