elefhead / numpy-cnn Goto Github PK
View Code? Open in Web Editor NEWA numpy based CNN implementation for classifying images
A numpy based CNN implementation for classifying images
Hello! When I run cnn.py, I received error as following:
FileNotFoundError: [Errno 2] No such file or directory: './data/data_batch_1'
could you please check it?
I've seen that in flatten.py you are transposing the input after flattening and reshaping with np.reshape(Z.shape[0], -1)
.
If this is the output from the previous layer:
array([[[[-18.0992297 , 4.02661879, -26.38740113],
[ 4.1076395 , 5.11381946, -1.99698891],
[ 3.52465515, 12.75818289, -1.3031802 ]]],
[[[ -6.1276822 , -0.63462835, 0.65559075],
[ 0.09962715, 3.65460836, 7.24738437],
[-21.24060198, -0.21378359, -21.09988605]]],
[[[-34.73760556, 4.71261136, 23.10390976],
[ -7.06577993, 15.1269017 , 6.36696882],
[-31.18436636, -5.41256305, 25.87760449]]],
[[[ 12.32376955, -23.15656867, -2.30117432],
[ 4.28086566, 6.55903427, -17.02264095],
[-18.28691051, -16.67304131, 16.4118617 ]]]])
# a.shape = (4, 1, 3, 3) --> feature_maps, depth, height, width
than the output of the Flatten layer will be:
array([[-18.0992297 , -6.1276822 , -34.73760556, 12.32376955],
[ 4.02661879, -0.63462835, 4.71261136, -23.15656867],
[-26.38740113, 0.65559075, 23.10390976, -2.30117432],
[ 4.1076395 , 0.09962715, -7.06577993, 4.28086566],
[ 5.11381946, 3.65460836, 15.1269017 , 6.55903427],
[ -1.99698891, 7.24738437, 6.36696882, -17.02264095],
[ 3.52465515, -21.24060198, -31.18436636, -18.28691051],
[ 12.75818289, -0.21378359, -5.41256305, -16.67304131],
[ -1.3031802 , -21.09988605, 25.87760449, 16.4118617 ]])
# a.shape == (4, 9)
It isn't flattened. What didn't I understand? Why not just returning Z.flatten()
?
Thanks!
I've looked at the code and in layers/convolution.py line 156:
dA[i, :, :, :] = da_pad[pad_h: -pad_h, pad_w: -pad_w, :]
If you use 'valid' padding then pad_w and pad_h would be 0 which will put an empty array in dA.
dA[i, :, :, :] = da_pad[0: -0, 0: -0, :]
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.