Ver Fonte

adaptation towards recent caffe layout, made location globally known

Alexander Freytag há 8 anos atrás
pai
commit
9b6c843a8d
2 ficheiros alterados com 11 adições e 2 exclusões
  1. 4 1
      caffe_load_network.m
  2. 7 1
      initWorkspaceCaffeTools.m

+ 4 - 1
caffe_load_network.m

@@ -38,7 +38,10 @@ function [net, mean_data] = caffe_load_network ( s_pathtodeployfile, s_pathtomod
     end
     
     %% load mean image and adapt to network input size
-    mean_data  = caffe.io.read_mean( s_meanfile );
+    load ( s_meanfile, 'mean_data' );
+    % note: old caffe versions needed the explicit function:
+    %mean_data  = caffe.io.read_mean( s_meanfile );
+    
     % crop center from mean file according to network size
     i_sizeMean = size( mean_data );
     offset_row = floor ( int32( i_sizeMean(1)-i_currentNetInputSize(1) ) / 2 ) + 1;

+ 7 - 1
initWorkspaceCaffeTools.m

@@ -17,9 +17,9 @@ function initWorkspaceCaffeTools
 % 
 
 
-
     %% setup paths of 3rd-party libraries in a user-specific manner
 
+    
     CAFFEDIR            = [];
 
         
@@ -29,9 +29,15 @@ function initWorkspaceCaffeTools
         
         s_dest_caffebuild     = sprintf( '/home/freytag/lib/caffe_%s/matlab/', s_hostname );    
         CAFFEDIR              = s_dest_caffebuild;       
+    elseif strcmp( getenv('USER'), 'alex') 
+        CAFFEDIR              = '/home/alex/lib/caffe/matlab/';
     else          
         fprintf('Unknown user %s and unknown default settings', getenv('USER') ); 
     end
+    
+    %% make path to caffe known as global variable
+    global s_path_to_caffe;
+    s_path_to_caffe     = CAFFEDIR;      
 
     %% add paths which come with this repository