summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRonghang Hu <huronghang@hotmail.com>2015-10-16 21:19:59 -0700
committerRonghang Hu <huronghang@hotmail.com>2015-10-16 21:31:41 -0700
commite5a74b282efb2293a05d91635a5b26837adc2aa3 (patch)
treef14db3a73b9d86da7a7783b3356223802566ad6c
parentdfcdb721c6286b7ff40aba3589df1d8e9d281bd9 (diff)
downloadcaffeonacl-e5a74b282efb2293a05d91635a5b26837adc2aa3.tar.gz
caffeonacl-e5a74b282efb2293a05d91635a5b26837adc2aa3.tar.bz2
caffeonacl-e5a74b282efb2293a05d91635a5b26837adc2aa3.zip
Test reading and writing mean proto in matlab
-rw-r--r--matlab/+caffe/+test/test_io.m18
-rw-r--r--matlab/+caffe/run_tests.m3
2 files changed, 20 insertions, 1 deletions
diff --git a/matlab/+caffe/+test/test_io.m b/matlab/+caffe/+test/test_io.m
new file mode 100644
index 00000000..2c34bd1e
--- /dev/null
+++ b/matlab/+caffe/+test/test_io.m
@@ -0,0 +1,18 @@
+classdef test_io < matlab.unittest.TestCase
+ methods (Test)
+ function test_read_write_mean(self)
+ % randomly generate mean data
+ width = 200;
+ height = 300;
+ channels = 3;
+ mean_data_write = 255 * rand(width, height, channels, 'single');
+ % write mean data to binary proto
+ mean_proto_file = tempname();
+ caffe.io.write_mean(mean_data_write, mean_proto_file);
+ % read mean data from saved binary proto and test whether they are equal
+ mean_data_read = caffe.io.read_mean(mean_proto_file);
+ self.verifyEqual(mean_data_write, mean_data_read)
+ delete(mean_proto_file);
+ end
+ end
+end
diff --git a/matlab/+caffe/run_tests.m b/matlab/+caffe/run_tests.m
index 93896855..6dbf6b23 100644
--- a/matlab/+caffe/run_tests.m
+++ b/matlab/+caffe/run_tests.m
@@ -11,7 +11,8 @@ caffe.reset_all();
% put all test cases here
results = [...
run(caffe.test.test_net) ...
- run(caffe.test.test_solver) ];
+ run(caffe.test.test_solver) ...
+ run(caffe.test.test_io) ];
% reset caffe after testing
caffe.reset_all();