Skip to content

Instantly share code, notes, and snippets.

View Noiredd's full-sized avatar

Przemysław Dolata Noiredd

  • Wroclaw University of Science and Technology
  • Wrocław, Poland
View GitHub Profile
@Noiredd
Noiredd / test_analyze.py
Created October 3, 2017 13:54
#5960 - results analysis
import numpy as np
def load_results():
path = '' #if you run from a different folder
a = np.load(path+'test_forward_start_end_ipblob.npy')
b = np.load(path+'test_forward_start_end_manual.npy')
c = np.load(path+'test_backward_start_end_convblob.npy')
d = np.load(path+'test_backward_start_end_manual.npy')
return a, b, c, d
@Noiredd
Noiredd / test_net.py
Last active October 3, 2017 13:53
#5960 - test_net.py modification
#Replace the corresponding functions in test_net.py
def test_forward_start_end(self):
conv_blob=self.net.blobs['conv'];
ip_blob=self.net.blobs['ip_blob'];
sample_data=np.random.uniform(size=conv_blob.data.shape);
sample_data=sample_data.astype(np.float32);
#"""Uncomment the following to load previously stored initializations"""
#sample_data=np.load('test_forward_start_end_data.npy');
#self.net.params['ip'][0].data[...]=np.load('test_forward_start_end_weights.npy');
#self.net.params['ip'][1].data[...]=np.load('test_forward_start_end_biases.npy');
@Noiredd
Noiredd / 5173_vsScikit.py
Created June 27, 2017 14:14
additional example for #5173
from skimage.transform import rescale
import numpy as np
import caffe
inputArray = np.array( [[0.1, 0.2, 0.3, 0.4], [0.4, 0.3, 0.2, 0.1]] )
scikitResult = rescale(inputArray, scale=2, mode='constant', cval=0)
net = caffe.Net('5173_vsScikit.pt', caffe.TRAIN)
net.blobs['data'].data[0][0][...] = inputArray
net.forward()
@Noiredd
Noiredd / 5173_vsScikit.pt
Created June 27, 2017 13:59
additional example for #5173
input: "data"
input_shape {
dim: 1
dim: 1
dim: 2
dim: 4
}
layer {
name: "x2"
type: "Deconvolution"
@Noiredd
Noiredd / 5173.py
Last active October 2, 2017 11:00
example code for #5173 (caffe)
import caffe
n = caffe.Net('5173.pt', caffe.TRAIN)
for l in n.layers[2:]:
print l.blobs[0].data
print 'These should be equal:', l.blobs[0].data.flatten()[0], l.blobs[0].data.flatten()[-1]
@Noiredd
Noiredd / 5173.pt
Last active June 28, 2017 08:18
example network for #5173 (caffe)
input: "data"
input_shape {
dim: 1
dim: 1
dim: 350
dim: 576
}
layer {
name: "bilinear3"
type: "Deconvolution"
@Noiredd
Noiredd / deploy.prototxt
Created April 12, 2017 10:35
AlexNet without importing FC layers
input: "data"
input_shape {
dim: 1
dim: 3
dim: 227
dim: 227
}
layer {
name: "conv1"
type: "Convolution"