CEA-LIST / N2D2

N2D2 is an open source CAD framework for Deep Neural Network simulation and full DNN-based applications building.
Other
146 stars 35 forks source link

Strange behaviour with transformations #91

Closed FabriceAuz closed 3 years ago

FabriceAuz commented 3 years ago

Hi, I'm trying to run a MobileNet network on a database of images. There are several different image sizes, so I first resize them. When running N2D2, I get a strange runtime error:

CUDNN initialized on device #0
Learning database size: 396 images
Validation database size: 5521 images
Testing database size: 31602 images
Notice: stimuli depth is 8U (according to database first stimulus)
[LOG] Stimuli transformations flow (transformations.png)
[LOG] Network graph (MobileNet_v1_batchnorm.ini.png)
[LOG] Network SVG graph (MobileNet_v1_batchnorm.ini.svg)
[LOG] Network stats (stats/*)
[LOG] Solvers scheduling (schedule/*)
[LOG] Layer's receptive fields (receptive_fields.log)
[LOG] Labels mapping (*.Target/labels_mapping.log)
[LOG] Labels legend (*.Target/labels_legend.png)
[LOG] Learn frame samples (frames/frame*)
terminate called after throwing an instance of 'std::runtime_error'
  what():  StimuliProvider::readStimulus(): expected data size is 128 128 3 , but size after transformations is 128 128 4  for stimulus: /local/DATABASE/AI4DI/Wafer/training/7/19423.png
Abandon (core dumped)

I tried to remove some transformations in the ini file but always get a similar error, even when there is only one transformation left:

; Environment
[sp]
SizeX=${SIZE}
SizeY=${SIZE}
NbChannels=3
BatchSize=${BATCH_SIZE}

[sp.Transformation-1]
Type=RescaleTransformation
Width=${SIZE}
Height=${SIZE}

There is also something curious in the output: my database is split between training, validation and test, with respectively 22104, 5521 and 9894 images. But N2D2 says:

Learning database size: 396 images
Validation database size: 5521 images
Testing database size: 31602 images

The ini file is attached. Thanks for your help. MobileNet_v1_batchnorm.txt

FabriceAuz commented 3 years ago

It may be due to the image files. Here is an example. 3

FabriceAuz commented 3 years ago

OK, I found out that my images had 4 channels instead of 3 as expected. I have changed them and now it works.