facebookresearch / deepmask

Torch implementation of DeepMask and SharpMask
Other
3.11k stars 507 forks source link

"bad argument #3 to '?' (torch.*Tensor expected, got nil)" training my own dataset #88

Closed nico00 closed 7 years ago

nico00 commented 7 years ago

Hi, I'm getting the following error message when I train my own dataset: $ th train.lua Found Environment variable CUDNN_PATH = /home/ubuntu/torch/cuda/lib64/libcudnn.so.5.0.5 -- ignore option rundir -- ignore option dm -- ignore option reload -- ignore option gpu
-- ignore option datadir
| running in directory /home/ubuntu/deepmask/exps/deepmask/exp
| number of paramaters trunk: 15198016
| number of paramaters mask branch: 1608768 | number of paramaters score branch: 526337 | number of paramaters total: 17333121
convert: data//annotations/instances_train2014.json --> .t7 [please be patient] converting: annotations convert: data//annotations/instances_train2014.json --> .t7 [please be patient] converting: images converting: annotations convert: building indices converting: images convert: building indices /home/ubuntu/torch/install/bin/luajit: ...e/ubuntu/torch/install/share/lua/5.1/threads/threads.lua:183: [thread 1 callback] bad argument #3 to '?' (torch.*Tensor expected, got nil) stack traceback: [C]: at 0x7f2912287bc0 [C]: in function 'newindex' /home/ubuntu/torch/install/share/lua/5.1/coco/CocoApi.lua:182: in function 'makeMap' /home/ubuntu/torch/install/share/lua/5.1/coco/CocoApi.lua:188: in function 'convert' /home/ubuntu/torch/install/share/lua/5.1/coco/CocoApi.lua:128: in function 'init' /home/ubuntu/torch/install/share/lua/5.1/torch/init.lua:91: in function </home/ubuntu/torch/install/share/lua/5.1/torch/init.lua:87> [C]: in function 'CocoApi' /home/ubuntu/deepmask/DataSampler.lua:25: in function 'init' /home/ubuntu/torch/install/share/lua/5.1/torch/init.lua:91: in function </home/ubuntu/torch/install/share/lua/5.1/torch/init.lua:87> [C]: in function 'DataSampler' /home/ubuntu/deepmask/DataLoader.lua:36: in function </home/ubuntu/deepmask/DataLoader.lua:30> [C]: in function 'xpcall' ...e/ubuntu/torch/install/share/lua/5.1/threads/threads.lua:234: in function 'callback' /home/ubuntu/torch/install/share/lua/5.1/threads/queue.lua:65: in function </home/ubuntu/torch/install/share/lua/5.1/threads/queue.lua:41> [C]: in function 'pcall' /home/ubuntu/torch/install/share/lua/5.1/threads/queue.lua:40: in function 'dojob' [string " local Queue = require 'threads.queue'..."]:13: in main chunk stack traceback: [C]: in function 'error' ...e/ubuntu/torch/install/share/lua/5.1/threads/threads.lua:183: in function 'dojob' ...e/ubuntu/torch/install/share/lua/5.1/threads/threads.lua:264: in function 'synchronize' ...e/ubuntu/torch/install/share/lua/5.1/threads/threads.lua:142: in function 'specific' ...e/ubuntu/torch/install/share/lua/5.1/threads/threads.lua:125: in function 'Threads' /home/ubuntu/deepmask/DataLoader.lua:40: in function '__init' /home/ubuntu/torch/install/share/lua/5.1/torch/init.lua:91: in function </home/ubuntu/torch/install/share/lua/5.1/torch/init.lua:87> [C]: in function 'DataLoader' /home/ubuntu/deepmask/DataLoader.lua:21: in function 'create' train.lua:101: in main chunk [C]: in function 'dofile' ...untu/torch/install/lib/luarocks/rocks/trepl/scm-1/bin/th:150: in main chunk [C]: at 0x00405d50

Please note I'm using CUDA 7.5.18 under Ubuntu, Thanks Nico

nico00 commented 7 years ago

I've installed Cuda 8.0 but I'm getting the same error. I'm trying to train the system with a small dataset, just to understand how it works. Basically I've selected three images on both train2014 and val2014, I've modified annotations accordingly, defining only one category_id. Then I've patched DataSampler.lua as per #72. I've attached the dataset I'm testing. Any idea about what I'm doing wrong ? Thanks Nico data.tar.gz

nico00 commented 7 years ago

I've found out the problem: one of the two json I've created is wrong. Simple as that. Thanks Nico

bermeitinger-b commented 7 years ago

@nico00 Could you please tell us how you created the json?

nico00 commented 7 years ago

Honestly I don't remember exactly what was the problem, for sure it was related to the structure of the json. I found out the problem checking it using the attached schema I wrote. Hope it helps. coco.schema.txt

nico00 commented 7 years ago

Sorry I didn't answer your question :) To create it I simply followed the details you can find here: http://mscoco.org/dataset/#download

bermeitinger-b commented 7 years ago

Thank you for the links. I'm struggeling with creating the segmentations. I used the CocoAPI, but I can't follow which format I have to put into the JSON for segmentation, counts, bbox or how to convert my own data.

nico00 commented 7 years ago

Basically you have to play with COCO's functions. Segmentation is an array of arrays of points that describe the path for a certain category. The format is [[x1,y1,x2,y2,...,xn,yn]]. Once you have that list of points in a tensor you can create a mask using frPoly. Using such mask you can calculate area and bounding box respectively with area and toBbox. All these are functions defined in MaskApi.