chsasank / plantvillage-challenge

Code in Torch for PlantVillage challenge: https://www.crowdai.org/challenges/1
17 stars 11 forks source link

Assertion failed #1

Closed staywithme23 closed 7 years ago

staywithme23 commented 7 years ago

Nice code, but when I modify and use my own dataset, I got this error: (The problem seems to be when put the input to the model, the tensor input should also in cuda?) (cmd: th main.lua -model resnet -depth 34 -learningRate 0.1 -data datasets/data-torch/)

.../cudnn/init.lua:64: assertion failed! [C]: in function 'assert' /home/adwin5/torch/install/share/lua/5.1/cudnn/init.lua:64: in function 'toDescriptor' ...torch/install/share/lua/5.1/cudnn/SpatialConvolution.lua:116: in function 'createIODescriptors' ...torch/install/share/lua/5.1/cudnn/SpatialConvolution.lua:366: in function <...torch/install/share/lua/5.1/cudnn/SpatialConvolution.lua:363> [C]: in function 'xpcall' /home/adwin5/torch/install/share/lua/5.1/nn/Container.lua:63: in function 'rethrowErrors' /home/adwin5/torch/install/share/lua/5.1/nn/Sequential.lua:44: in function 'forward' /home/adwin5/testing/plantvillage-challenge/train.lua:112: in function 'train' main.lua:71: in main chunk

staywithme23 commented 7 years ago

(If I use alexnet with backend nn, I get the following error:) /home/adwin5/torch/install/bin/luajit: /home/adwin5/torch/install/share/lua/5.1/nn/THNN.lua:110: Assertion `THIndexTensor_(size)(target, 0) == batch_size' failed. at /home/adwin5/torch/extra/nn/lib/THNN/generic/ClassNLLCriterion.c:46 stack traceback: [C]: in function 'v' /home/adwin5/torch/install/share/lua/5.1/nn/THNN.lua:110: in function 'ClassNLLCriterion_updateOutput' ...in5/torch/install/share/lua/5.1/nn/ClassNLLCriterion.lua:41: in function 'forward' /home/adwin5/testing/plantvillage-challenge/train.lua:113: in function 'train'

chsasank commented 7 years ago

First bug should be fixed now.

As for the second bug, make sure

  1. you set the right number of classes,
  2. your folder names are similar to that of plantvillage. Alternatively change getClass function in datasets/plantvillage.lua. Note that in torch classes start from 1 not 0.