Skip to content

Instantly share code, notes, and snippets.

View hkhojasteh's full-sized avatar
☁️
From the top of the clouds.

Hadi Abdi Khojasteh hkhojasteh

☁️
From the top of the clouds.
View GitHub Profile
//Make good representation for clustering
Mat points = Mat::zeros(sum(img_zeroone)[0], 2, CV_32F);
for (int i = 0, k = 0; i < img_zeroone.rows; i++){
for (int j = 0; j < img_zeroone.cols; j++){
if ((int)img_zeroone.at<char>(i, j) == 255){
points.at<float>(k, 0) = i;
points.at<float>(k, 1) = j;
k++;
}
}
#conv1
with tf.variable_scope('conv1') as scope:
kernel = _variable_with_weight_decay('weights', shape=[5, 5, 3, 64], stddev=5e-2, wd=None)
conv = tf.nn.conv2d(images, kernel, [1, 1, 1, 1], padding='SAME')
biases = _variable_on_cpu('biases', [64], tf.constant_initializer(0.0))
pre_activation = tf.nn.bias_add(conv, biases)
conv1 = tf.nn.relu(pre_activation, name=scope.name)
_activation_summary(conv1)
#pool1
pool1 = tf.nn.max_pool(conv1, ksize=[1, 3, 3, 1], strides=[1, 2, 2, 1], padding='SAME', name='pool1')