wiseodd / hipsternet Goto Github PK
View Code? Open in Web Editor NEWAll the hipster things in Neural Net in a single repo
License: The Unlicense
All the hipster things in Neural Net in a single repo
License: The Unlicense
Hello, I am trying to follow your im2col code. My intention is to do the forward pass of an RGB image without using any framework API. Right now I am using Keras.
I have started i the following way --
1/ Extract the weight from the model using
layer.get_weights()
2/ Then I have appended the output oflayer.get_weights()
in a list named layerdic
3/ I have assigned an array conv_kernel and stored here the value of layerdic[0][0] and another array named conv_bias where I have stored layerdic[0][1]. If I am not wrongconv_kernel
stores the value of kernel weight andconv_bias
stores the bias value which I need for convolution.
4/ Then I have assigned an input image in X_test array and has done the convolution with your code.
My query is now ---
1/ What is the significance of out and cache and where do I need these values for the next part of forward pass?
1/ How can I do the next calculation. For example, in my case I will do the Flatten and Dense for classification. How can I approach for this purpose?
I am giving below my model:
model = Sequential()
model.add(Conv2D(1, (3, 3), padding='same',
input_shape=(3, IMG_SIZE, IMG_SIZE),
activation='relu'))
model.add(Flatten())
model.add(Dense(NUM_CLASSES, activation='softmax'))
return model
model = cnn_model()
lr = 0.01
sgd = SGD(lr=lr, decay=1e-6, momentum=0.9, nesterov=True)
model.compile(loss='categorical_crossentropy',
optimizer=sgd,
metrics=['accuracy'])
Kindly please help me.
How does this method work and do the 2D filtering? What is the name of this algorithm in algebra?
Thank you!
I have tried the the codes in tf-gpu. But it doesnt seems to work !
Does it not support GPU computation ?
Hello, I am just trying to implement the contractive autoencoder but everytime I try to run it shows me this error:
RuntimeError Traceback (most recent call last)
in ()
----> 1 contractiveAutoencoder(X_train)
10 frames
/usr/local/lib/python3.7/dist-packages/tensorflow/python/framework/func_graph.py in wrapper(*args, **kwargs)
984 except Exception as e: # pylint:disable=broad-except
985 if hasattr(e, "ag_error_metadata"):
986 raise e.ag_error_metadata.to_exception(e)
987 else:
988 raise
RuntimeError: in user code:
/usr/local/lib/python3.7/dist-packages/tensorflow/python/keras/engine/training.py:855 train_function *
return step_function(self, iterator)
<ipython-input-5-80182a51a910>:15 contractive_loss *
W = tf.Variable(value=model.get_layer('encoded').get_weights()[0]) # N x N_hidden
/usr/local/lib/python3.7/dist-packages/tensorflow/python/keras/engine/base_layer.py:1831 get_weights **
return backend.batch_get_value(output_weights)
/usr/local/lib/python3.7/dist-packages/tensorflow/python/util/dispatch.py:206 wrapper
return target(*args, **kwargs)
/usr/local/lib/python3.7/dist-packages/tensorflow/python/keras/backend.py:3746 batch_get_value
raise RuntimeError('Cannot get value inside Tensorflow graph function.')
RuntimeError: Cannot get value inside Tensorflow graph function.
'
I have tried many things to resolve this issues but i am unable to. Let me know if there is any solution for this.
from hipsternet/hipsternet/loss.py line 112
def l1_regression(model, y_pred, y_train, lam=1e-3):
m = y_pred.shape[0]
data_loss = np.sum(np.abs(y_train - y_pred)) / m
reg_loss = regularization(model, reg_type='l2', lam=lam) #<----- should this be l1 not l2
return data_loss + reg_loss
Shouldn't it be calling regularization with reg_type='l1' and not 'l2'?
I think you have error in _pool_backward function at this place:
dX = dpool_fun(dX_col, dout_col, pool_cache)
You set dX which is not used later.
UPD: IT actually not critical since dX_col is changed internally. So this line can be changed on:
dpool_fun(dX_col, dout_col, pool_cache)
or
dX_col= dpool_fun(dX_col, dout_col, pool_cache)
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.