神经网络教程神经网络_turial.lua中的数据预处理问题

我已经安装了 torch deep learning module,首先使用 git clone 然后使用 luarocks make 这个步骤,安装成功了。在 Torch 提示符下,require 'dp' 正常工作。

但是,当我尝试执行 neuralnetwork_tutorial.luath neuralnetwork_tutorial.lua)时,它报以下错误。

Tanny @neuralnetwork_tutorial.lua: About to initiate: datasource = dp.Mnist{input_preprocess = dp.Standardize()}
Tanny @/home/ubuntu/binaries/torches/torch/install/share/lua/5.1/dp/preprocess/standardize.lua: Marked presence!!!
Tanny @/home/ubuntu/binaries/torches/torch/install/share/lua/5.1/dp/torch/File.lua says: @177 typeidx=  3
Tanny @/home/ubuntu/binaries/torches/torch/install/share/lua/5.1/dp/torch/File.lua says: @177 typeidx=  1
Tanny @/home/ubuntu/binaries/torches/torch/install/share/lua/5.1/dp/torch/File.lua says: @177 typeidx=  4
Tanny @/home/ubuntu/binaries/torches/torch/install/share/lua/5.1/dp/torch/File.lua says: @177 typeidx=  0
Tanny @/home/ubuntu/binaries/torches/torch/install/share/lua/5.1/dp/torch/File.lua says: @177 typeidx=  28
Tanny @/home/ubuntu/binaries/torches/torch/install/share/lua/5.1/dp/torch/File.lua says: @259 typeidx=  28
/home/ubuntu/binaries/torches/torch/install/bin/luajit: ...aries/torches/torch/install/share/lua/5.1/torch/File.lua:260: unknown object
stack traceback:
        [C]: in function 'error'
        ...aries/torches/torch/install/share/lua/5.1/torch/File.lua:260: in function 'readObject'
        ...aries/torches/torch/install/share/lua/5.1/torch/File.lua:252: in function 'readObject'
        ...aries/torches/torch/install/share/lua/5.1/torch/File.lua:277: in function 'loadData'
        ...es/torches/torch/install/share/lua/5.1/dp/data/mnist.lua:74: in function 'loadTrainValid'
        ...es/torches/torch/install/share/lua/5.1/dp/data/mnist.lua:61: in function '__init'
        ...aries/torches/torch/install/share/lua/5.1/torch/init.lua:50: in function <...aries/torches/torch/install/share/lua/5.1/torch/init.lua:46>
        [C]: in function 'Mnist'
        neuralnetwork_tutorial.lua:16: in main chunk
        [C]: in function 'dofile'
        ...ches/torch/install/lib/luarocks/rocks/trepl/scm-1/bin/th:131: in main chunk
        [C]: at 0x0804d650

我在这些脚本中放了一些 print 语句以了解执行流程。我注意到,在 File.lua 中,在获取对象之后的第一步是确定对象类型;已经声明了 8 种类型,从 0 到 7,其中 0 是TYPE_NIL。然而代码失败了,因为它检测到类型 28(??)。

请指出我哪里错了,或在哪里寻找问题?

P.S.:脚本会自动下载数据,但由于某些标准企业代理设置问题,无法下载。因此,我个人下载了数据 MNIST 并将其存储在指定的数据目录中。如果这是一个线索的话?

点赞
用户49985
用户49985

就是这样,这是代码中的 bug(序列化的 MNIST 不是跨平台的)造成的。通过使用 ascii 格式而不是二进制来序列化数据集来解决问题。

2015-02-04 16:01:04