pylearn


predictions using pylearn2 models


I have trained the following CNN model using pylearn2.
h1
Input space: Conv2DSpace(shape=(25, 150), num_channels=1, axes=('b', 0, 1, 'c'), dtype=float64)
Total input dimension: 3750
h2
Input space: Conv2DSpace(shape=(11, 73), num_channels=8, axes=('b', 'c', 0, 1), dtype=float64)
Total input dimension: 6424
h3
Input space: VectorSpace(dim=1024, dtype=float64)
Total input dimension: 1024
h4
Input space: VectorSpace(dim=1024, dtype=float64)
Total input dimension: 1024
y
Input space: VectorSpace(dim=1024, dtype=float64)
Total input dimension: 1024
You can observe that input examples to this CNN are gray images of size 25 x150. The final number of outputs are 10, that is, the layer 'y' has an output dimension of 10.
My training dataset is created using the CSVDataset in pylearn2, and I'm able to train the model.
However, I have a problem in making predictions using this model, which I'm trying to do using the predict_csv.py file in scripts/mlp folder.
The problem is that predict_csv.py directly loads the test.csv file into a 2d matrix of 1000 x 3750 representing 1000 test examples each having 3750 pixels each. However, while predicting theano expects the input to be of the same format as input of layer 'h1'. The following error occurs:
TypeError: ('Bad input argument to theano function with name "../mlp/predict_csv.py:111" at index 0(0-based)', 'Wrong number of dimensions: expected 4, got 2 with shape (1000, 3750).')
I guess the required format is the ('b', 0, 1, 'c') format of pylearn2.
I would really like to know how do we make this transformation from the 2d array to the above required format. Or any other way this problem could be dealt with?
To solve my problem, I ended up manually converting the 2D set of images (1000 x 3750) to a 4D array with columns as number-of-examples, rows and columns in image, and number-of-channels (1000 x 25 x 150 x 1). It worked fine after this transformation.
I was hoping to find a pylearn2 class or function that directly served my purpose, because while training, pylearn2 is obviously making this change in space itself.

Related Links

predictions using pylearn2 models

Categories

HOME
cakephp-3.x
vue.js
shopify
npm
nlp
checkbox
scipy
voip
nuxeo
windows-7
apple-numbers
tumblr
bro
browserify
subquery
metronic
xamarin-studio
game-maker-studio-1.4
ctypes
gwtp
maxima
equalizer
glpk
react-leaflet
medium-editor
opera-mini
reduction
jive
cruisecontrol.net
fop
kitematic
dspic
k2
myob
fabric
activepython
rhandsontable
maximo
classpath
ggmap
aurelia-binding
mangodb
npm-shrinkwrap
gettext
shibboleth
redhat-datavirt
code-behind
installshield-2012
delphi-10.1-berlin
stdclass
distributed-transactions
cppunit
amd
bids
dojox.grid.datagrid
w3-total-cache
jexl
selenium-firefoxdriver
polar-coordinates
barcode-printing
gulp-typescript
typhoon
glkit
multifile-uploader
listadapter
coordinate-transformation
search-regex
schtasks.exe
file-diffs
affix
rad
gulp-livereload
xaml-designer
robocode
low-level
android-search
start-job
python-ggplot
belongs-to
utf-32
formvalidation-plugin
ember-components
bullet
planetary.js
phpdocx
indexing-service
lov
robospice
sttwitter
javascriptmvc
multiple-conditions
qss
zend-framework-modules
bulbs
sunspot-rails
static-variables
mpmovieplayer
jpf
signals2
hashalgorithm
electronic-signature
camtasia
graniteds
web-statistics
virtualquery
handheld
outlook-form
ajaxpro

Resources

Mobile Apps Dev
Database Users
javascript
java
csharp
php
android
MS Developer
developer works
python
ios
c
html
jquery
RDBMS discuss
Cloud Virtualization
Database Dev&Adm
javascript
java
csharp
php
python
android
jquery
ruby
ios
html
Mobile App
Mobile App
Mobile App