no idea why gradient is not applied..

import tensorflow as tf
import numpy as np
a= np.zeros((2,2), dtype=”float32″)
b= np.array([[6,7],[8,9]], dtype=”float32″)
print(b)
t1= tf.placeholder(tf.float32, shape=(2,2))
label_t = tf.placeholder(tf.float32, shape=(2,2))
t2 = tf.layers.dense(t1,2, activation=tf.nn.relu)
# t2 = tf.layers.dense(t_mid, 2, activation=tf.nn.relu)
# loss1 = tf.losses.mean_squared_error(label_t, t2)
loss1 = tf.reduce_sum(tf.square(label_t – t2))
optimizer = tf.train.AdamOptimizer(0.1)
train_op22 = optimizer.minimize(loss1)
# grad = optimizer.compute_gradients(loss1)
# train_op = optimizer.apply_gradients(grad)
# initop = tf.global_variables_initializer()
# vnames = [ v.name for v in tf.trainable_variables()]
# print(“vnames”, vnames)
g = tf.get_default_graph()
with tf.Session(graph=g) as sess:
sess.run(tf.global_variables_initializer())
steps=2
for i inrange(steps):
print(“trainop”, train_op22)
pred2, loss_val, _= sess.run([t2,loss1, train_op22], feed_dict={t1:a, label_t:b})
print(“loss”, loss_val)
# print(“pred2”, pred2)
# print(“grad”, grad_out)
# for v in vnames_out:
# print(v)
# for t,v in grad_out:
# print(t)
# print(v)
# print(“===”)
# pred = sess.run(t2, feed_dict={t1:a, label_t:b})
# print(“pred”,pred)
# print(a)
Advertisements

spatial transformer networks

encountered while reading “STN-OCR: A Single Neural Network for Text Detection and Text Recognition” which adopted spatial transformer networks.

This video is very clear in understanding how it works. Although I didn’t fully understand the interpolation equations, the other parts were clear. And at the end of the video, it briefly compares the spatial transformer with deformable convolutional networks which is interesting.

 

installation problems encountered when installing wiki.js

npm module error

When executing node wiki start it may call cannot find module xxxxx errors with EEXIST code.

The cause if two fold.

  1. NODE_PATH environment variable is not properly set
  2. the modules installed in node_modules directory are not properly installed.

For the NODE_PATH, the user can simply go do the node_modules directory inside the directory where the user installed wiki.js. And then export the NODE_PATH variable.

$ cd wiki_install_dir/node_modules
$ export NODE_PATH=$(pwd)

For the second part of the problem, the solution for me was to delete the node_modules directory entirely and reinstall it from the beginning.

$ cd wiki_install_dir
$ rm -rf node_modules
$ npm install

A few warning appeared but there weren’t any critical errors that interrupted the module installation process.
After these two operations, I did not encounter any “missing modules” error when running wiki.js

port problem

in dev mode and without a proxy server, using port 80 in linux will not be easy. By default it will be blocked and the user cannot see the wiki page from the browser even after executing node wiki restart. As another option, the user may configure it to work on another port for example 3000. The webpage will show up but the styling will not be applied since the url of the css files are pointing to port 80.

In order to solve this issue check out this page. I have followed the first solution since using port 80 is more convenient.

how to use TZe-CL6 tape

It was unexpectedly hard to find a simple guideline on how to use tze-CL6 cleaning tape.

Here is the response that I got from Brother.

 

Thank you for your email. I understand that you want to clean the print head of your PTP900W. I’ll be happy to help.
To clean your machine print head with the TZe-CL6 tape. You will need to install the tape cartridge, close the machine and press the (Feed&Cut) button. This will run the tape through the print head and will clean it.
If after following the previous instructions your machine is still having the same issue, it will require service. This model has a one year warranty from the manufacturing date or the purchase date. Please reply to this email with the following information in order to confirm the warranty:
•  Serial number for the Brother machine
•  Proof of purchase (i.e. receipt/invoice)

Thank you again for emailing us. If we can be of further assistance, please let us know. You may also contact us toll-free at 1-877-Brother (1-877-276-8437), Monday through Friday from 9AM – 9PM EST, excluding holidays. We are happy to help.

At Your Side,
Enver
Brother