Skip to content

Commit fbd3feb

Browse files
committed
final version done.
1 parent 8e352f8 commit fbd3feb

27 files changed

+383
-2087
lines changed

bin/Convolution.o

-8 Bytes
Binary file not shown.

bin/Filter.o

16 Bytes
Binary file not shown.

helpers/load_img.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,6 @@
2828

2929
result = Image.fromarray(im.astype(np.uint8))
3030

31-
result.save(sys.argv[2] + "/" + str(idx) + ".bmp")
31+
result.save(sys.argv[2] + "/" + "result"+str(idx) + ".bmp")
3232

3333
f.readline() # empty line

include/Convolution.hpp

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,20 +6,22 @@
66
#include "Filter.hpp"
77

88
class Convolution {
9-
int in_width, in_height, in_depth,
10-
n_filters, window, stride, padding,
11-
out_width, out_height, out_depth;
9+
10+
int in_width, in_height, in_depth, n_filters, window, stride, padding, out_width, out_height, out_depth;
1211

1312
public:
14-
Convolution(int _width, int _height, int _depth, int _window, int _stride = 1, int _padding = 0, int n_filters = 1);
1513

16-
~Convolution();
14+
// Constructor
15+
Convolution(int _width, int _height, int _depth, int _window, int _stride = 1, int _padding = 0, int n_filters = 1);
1716

1817
// Applies convolutional filters in filters to input volume x
1918
// x treated as in_width * in_height * in_depth
2019
// assumed n_filters elements in filters vector
2120
// returns shape of the output volume and pointer to the memory block
2221
std::tuple<int, int, int, double ***> conv2d(double ***x, const std::vector<Filter*> &filters);
22+
23+
// Destructor
24+
~Convolution();
2325
};
2426

2527
#endif

include/Filter.hpp

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,18 +15,21 @@ class Filter {
1515

1616
// Constructors
1717
Filter(int _window, int _depth);
18-
Filter(double ***_w, int _window, int _depth, int _b = 0); // constructor with kernel matrix and bias term
1918

20-
// Destructor
21-
~Filter();
19+
// constructor with kernel matrix and bias term
20+
Filter(double ***_w, int _window, int _depth, int _b = 0);
21+
2222

2323
// normalize the tensor
2424
void normalize();
2525

2626

27-
// normalize kernel matrix
28-
void normalize_kernel();
27+
// Destructor
28+
~Filter();
29+
2930

31+
32+
3033
};
3134

3235
#endif

input/colored/airplane.png

-440 KB
Binary file not shown.

input/colored/fruits.png

-461 KB
Binary file not shown.

input/colored/lena.png

-501 KB
Binary file not shown.

input/extra/airplane.png

157 KB
Loading
File renamed without changes.

input/extra/demba.png

117 KB
Loading

input/extra/fruits.png

164 KB
Loading
File renamed without changes.

input/extra/lena.png

168 KB
Loading
File renamed without changes.

output/histogram.png

-664 Bytes
Loading

0 commit comments

Comments
 (0)