Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

The same as "attempt to concatenate local 'ext' (a nil value)" #11 #40

Open
KunihiroS opened this issue Dec 5, 2015 · 3 comments
Open

Comments

@KunihiroS
Copy link

Hi, I have completely the same issue with this even though I am running the latest resources that this issue has been patched. (I confirm #12 as well and there is no problem with my resources "DataLoaderRaw.lua".)
OSX 10.9.5, Mac book pro Retina, 15-inch, Late 2013 (no GPU). It seems caused by the invisible files though, there is no invisible files in the directory of /img/ where the objective images are stored.

I have been trying to run "neuraltalk2" somehow and it seems to be getting close, so please somebody points out what is the cause of this problem.

[The error is the below (exactly the same though)]

$ th eval.lua -model /Users/usrname/neuraltalk2/model_id1-501-1448236541.t7_cpu.t7 -image_folder /Users/usrname/neuraltalk2/img/ -num_images 10 -gpuid -1
DataLoaderRaw loading images from folder: /Users/usrname/neuraltalk2/img/
listing all images in directory /Users/usrname/neuraltalk2/img/
DataLoaderRaw found 14 images
constructing clones inside the LanguageModel
/Users/usrname/torch/install/bin/luajit: /Users/usrname/torch/install/share/lua/5.1/image/init.lua:346: attempt to concatenate local 'ext' (a nil value)
stack traceback:
/Users/usrname/torch/install/share/lua/5.1/image/init.lua:346: in function 'load'
./misc/DataLoaderRaw.lua:82: in function 'getBatch'
eval.lua:116: in function 'eval_split'
eval.lua:173: in main chunk
[C]: in function 'dofile'
...s/usrname/torch/install/lib/luarocusrname/rocusrname/trepl/scm-1/bin/th:131: in main chunk
[C]: at 0x010e9f77b0

[/img/ ls -la]
$ ls -la
total 2088
drwxr-xr-x 14 usrname staff 476 12 5 16:38 .
drwxr-xr-x 19 usrname staff 646 12 5 16:38 ..
-rw-r--r--@ 1 usrname staff 102769 12 4 23:01 1.jpg
-rw-r--r--@ 1 usrname staff 112326 12 4 22:58 10.jpg
-rw-r--r--@ 1 usrname staff 158805 12 4 22:57 11.jpg
-rw-r--r--@ 1 usrname staff 29750 12 4 22:58 12.jpg
-rw-r--r--@ 1 usrname staff 47949 12 4 22:57 2.jpg
-rw-r--r--@ 1 usrname staff 52914 12 4 22:58 3.jpg
-rw-r--r--@ 1 usrname staff 35022 12 4 22:57 4.jpg
-rw-r--r--@ 1 usrname staff 141824 12 4 22:56 5.jpg
-rw-r--r--@ 1 usrname staff 128698 12 4 22:56 6.jpg
-rw-r--r--@ 1 usrname staff 185112 12 4 22:59 7.jpg
-rw-r--r--@ 1 usrname staff 29393 12 4 22:59 8.jpg
-rw-r--r--@ 1 usrname staff 18712 12 4 22:55 9.jpg

@jhorrell
Copy link

jhorrell commented Jan 8, 2016

Am running two versions of Ubuntu 14.04 with slightly different install histories. On one of these, I get the above error and not on the other when running eval.lua as per above. Both have today's version of neuraltalk2. The one that breaks has DataLoaderRaw finding two more images in the directory than are actually there (presume this is the "." and ".." entries). This is the same problem you are seeing above where it reports "DataLoaderRaw found 14 images" but your directory only has 12 jpg files.

I don't have the solution for the problem, but it may perhaps be related to the open pull request: #45

@jhorrell
Copy link

jhorrell commented Jan 8, 2016

Indeed, inserting a "print(fullpath)" at line 46 in DataLoaderRaw.lua gives output for me (showing clearly the "." and ".." problem -> note I only have 12 actual images in the folder):

$ th eval.lua -model ./model_id1-501-1448236541.t7_cpu.t7 -gpuid -1 -image_folder ./tmp_imgs -num_images 10

DataLoaderRaw loading images from folder: ./tmp_imgs
listing all images in directory ./tmp_imgs
./tmp_imgs/20151229_063125.72221.jpg
./tmp_imgs/20151229_064107.94641.jpg
./tmp_imgs/20160101_005544.96975.jpg
./tmp_imgs/20160101_001413.92238.jpg
./tmp_imgs/20160101_055442.20162.jpg
./tmp_imgs/..
./tmp_imgs/20151229_054848.12979.jpg
./tmp_imgs/20151229_055842.01612.jpg
./tmp_imgs/20151229_055500.12043.jpg
./tmp_imgs/20160101_060038.99836.jpg
./tmp_imgs/20160101_055637.00349.jpg
./tmp_imgs/20151229_063539.47561.jpg
./tmp_imgs/20160101_004327.98511.jpg
./tmp_imgs/.
DataLoaderRaw found 14 images


So, this piece of code (from line 43) is not performing as expected:

local n = 1
for file in paths.files(opt.folder_path, isImage) do
  local fullpath = path.join(opt.folder_path, file)
  table.insert(self.files, fullpath)
  table.insert(self.ids, tostring(n)) -- just order them sequentially
  n=n+1
end

@jhorrell
Copy link

jhorrell commented Jan 8, 2016

This hack (first exposure to lua) gets it to run again for me (from line 43 of DataLoaderRaw.lua):

local n = 1
for file in paths.files(opt.folder_path, isImage) do
  -- something wrong will the isImage call in line above for certain (slightly older?) installations
  -- hacky fix below to get things working again...
  if file == '.' or file == '..' then
      print 'skipping non-image file'
  else
      local fullpath = path.join(opt.folder_path, file)
      print(fullpath) -- debugging...
      table.insert(self.files, fullpath)
      table.insert(self.ids, tostring(n)) -- just order them sequentially
      n=n+1
  end
end

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants