| classdef io |
| |
| |
| methods (Static) |
| function im_data = load_image(im_file) |
| |
| |
| |
| |
| |
| |
| CHECK(ischar(im_file), 'im_file must be a string'); |
| CHECK_FILE_EXIST(im_file); |
| im_data = imread(im_file); |
| |
| if size(im_data, 3) == 3 |
| im_data = im_data(:, :, [3, 2, 1]); |
| end |
| |
| im_data = permute(im_data, [2, 1, 3]); |
| |
| im_data = single(im_data); |
| end |
| function mean_data = read_mean(mean_proto_file) |
| |
| |
| |
| CHECK(ischar(mean_proto_file), 'mean_proto_file must be a string'); |
| CHECK_FILE_EXIST(mean_proto_file); |
| mean_data = caffe_('read_mean', mean_proto_file); |
| end |
| function write_mean(mean_data, mean_proto_file) |
| |
| |
| |
| CHECK(ischar(mean_proto_file), 'mean_proto_file must be a string'); |
| CHECK(isa(mean_data, 'single'), 'mean_data must be a SINGLE matrix'); |
| caffe_('write_mean', mean_data, mean_proto_file); |
| end |
| end |
| end |
|
|