You are now following this question
- You will see updates in your followed content feed.
- You may receive emails, depending on your communication preferences.
Why do I receive this error message?
    2 views (last 30 days)
  
       Show older comments
    
Hello.
I tried to run the code via this link https://github.com/yifanw90/Zeyde_superes and I get errors below, can anyone help resolve this.
    % Training [0 x 1000] dictionary on 0 vectors using K-SVD
Error using ksvd (line 386)
Number of training signals is smaller than number of atoms to train
Error in learn_dict (line 49)
[conf.dict_lores, gamma] = ksvd(ksvd_conf); % , '');
Error in Example (line 25)
conf = learn_dict(conf, load_images(...
>>
18 Comments
  Walter Roberson
      
      
 on 10 Nov 2018
				Your data is empty.
  Chidiebere Ike
 on 10 Nov 2018
				
      Edited: Walter Roberson
      
      
 on 10 Nov 2018
  
			Thanks Walter for your response. I observed that too. I entered some images in Data (Test and Training) and still got errors below. I have attached a link for the same file with images in Data. What could be the reason for this error? Please guide me.
Training [0 x 1000] dictionary on 0 vectors using K-SVD
Error using ksvd (line 386)
Number of training signals is smaller than number of atoms to train
Error in learn_dict (line 49)
[conf.dict_lores, gamma] = ksvd(ksvd_conf); % , '');
Error in Example (line 25)
conf = learn_dict(conf, load_images(...
Thank you
  Walter Roberson
      
      
 on 10 Nov 2018
				The code uses MS Windows folder separator. I had to change from \ to / to get it to work on my Mac.
conf = learn_dict(conf, load_images(...
    glob('./CVPR08-SR/Data/Training', '*.bmp') ...
));
I also had to change the addpath to
addpath(fullfile(p, 'ksvdbox')); % K-SVD dictionary training algorithm
addpath(fullfile(p, 'ompbox')); % Orthogonal Matching Pursuit algorithm
  Chidiebere Ike
 on 10 Nov 2018
				Thanks Walter. I made all corrections as instructed and still got the errors stated below. I ran exactly the same Drive code I sent earlier. This is what I did:
if true
  % p = pwd;
addpath(fullfile(p, 'ksvdbox')); % K-SVD dictionary training algorithm
addpath(fullfile(p, 'ompbox')); % Orthogonal Matching Pursuit algorithm
% addpath(fullfile(p, '../CVPR08-SR'));
mat_file = 'conf.mat';
%%Simulation settings
conf.scale = 3; % scale-up factor
conf.level = 1; % # of scale-ups to perform
conf.window = [3 3]; % low-res. window size
conf.border = [1 1]; % border of the image (to ignore)
% High-pass filters for feature extraction (defined for upsampled low-res.)
conf.upsample_factor = 3; % upsample low-res. into mid-res.
O = zeros(1, conf.upsample_factor-1);
G = [1 O -1]; % Gradient
L = [1 O -2 O 1]/2; % Laplacian
conf.filters = {G, G.', L, L.'}; % 2D versions
conf.interpolate_kernel = 'bicubic';
conf.overlap = [1 1]; % partial overlap (for faster training)
      conf = learn_dict(conf, load_images(...            
          glob('./CVPR08-SR/Data/Training', '*.bmp')));
conf.overlap = conf.window - [1 1]; % full overlap scheme (for better reconstruction)
save(mat_file, 'conf');
end
This is the error I got:
if true
  % code>> clear all
>> Example
Training [30 x 1000] dictionary on 104788 vectors using K-SVD
Attempt to execute SCRIPT ompmex as a function:
/Users/ikechidiebere/Downloads/Zeyde_superes-master/ompbox/private/ompmex.m 
Error in omp (line 162)
gamma = ompmex(D,X,DtX,G,T,sparse_gamma,msgdelta,profile);
Error in ksvd>sparsecode (line 562)
Gamma = ompfunc(D,data,G,thresh,ompparams{:});
Error in ksvd (line 436)
Gamma = sparsecode(data,D,XtX,G,thresh);
Error in learn_dict (line 49)
[conf.dict_lores, gamma] = ksvd(ksvd_conf); % , '');
Error in Example (line 25)
conf = learn_dict(conf, load_images(...
>> end
What could be the reason for this?
Thank you
  Walter Roberson
      
      
 on 10 Nov 2018
				
      Edited: Walter Roberson
      
      
 on 10 Nov 2018
  
			here = pwd;
cd /Users/ikechidiebere/Downloads/Zeyde_superes-master/ompbox/private
make
cd /Users/ikechidiebere/Downloads/Zeyde_superes-master/ksvdbox/private
make
cd(here);
Example
  Chidiebere Ike
 on 10 Nov 2018
				Thanks for your response. I am sorry I don't understand your message sir. Can you please make it clear. Thanks
  Walter Roberson
      
      
 on 10 Nov 2018
				That is a sequence of commands you should execute.
The problem you have is that ompbox and ksvdbox have code that needs to be compiled; you have to cd to the appropriate directory and use the command "make" to compile the code.
  Chidiebere Ike
 on 11 Nov 2018
				
      Edited: Chidiebere Ike
 on 11 Nov 2018
  
			 I got this error. 
if true
  % >> here = pwd;
>> cd /Users/ikechidiebere/Downloads/Zeyde_superes-master/ompbox/private
>> make
Compiling ompmex...
Warning: Xcode appears to be installed, but it has not been configured.  Run "osascript -e 'do
shell script "xcode-select -switch /Applications/Xcode.app" with administrator privileges'" to
configure Xcode.  You must be an administrator of this computer to complete this action.
> In make (line 37) 
Error using mex
No supported compiler or SDK was found. For options, visit
https://www.mathworks.com/support/compilers.
Error in make (line 37)
mex('ompmex.c', ompsources{:},compile_params{:}); 
0:92: execution error: xcode-select: error: invalid developer directory '/Applications/Xcode.app' (1)
ans =
   1
>> cd /Users/ikechidiebere/Downloads/Zeyde_superes-master/ksvdbox/private
>> make
Compiling addtocols.c...
Warning: Xcode appears to be installed, but it has not been configured.  Run "osascript -e 'do
shell script "xcode-select -switch /Applications/Xcode.app" with administrator privileges'" to
configure Xcode.  You must be an administrator of this computer to complete this action.
> In make (line 39) 
Error using mex
No supported compiler or SDK was found. For options, visit
https://www.mathworks.com/support/compilers.
Error in make (line 39)
mex(sourcefiles{i}{:},compile_params{:});
0:92: execution error: xcode-select: error: invalid developer directory '/Applications/Xcode.app' (1)
ans =
   1
>> cd(here);
>> Example
Warning: Name is nonexistent or not a directory:
/Users/ikechidiebere/Downloads/Zeyde_superes-master/ompbox/private/ksvdbox 
> In path (line 109)
In addpath (line 94)
In Example (line 5) 
Warning: Name is nonexistent or not a directory:
/Users/ikechidiebere/Downloads/Zeyde_superes-master/ompbox/private/ompbox 
> In path (line 109)
In addpath (line 94)
In Example (line 6) 
Training [0 x 1000] dictionary on 0 vectors using K-SVD
Error using ksvd (line 386)
Number of training signals is smaller than number of atoms to train
Error in learn_dict (line 49)
[conf.dict_lores, gamma] = ksvd(ksvd_conf); % , '');
Error in Example (line 25)
      conf = learn_dict(conf, load_images(...
>> 
end
What could be the issue here? Please guide me
Thanks
  Chidiebere Ike
 on 11 Nov 2018
				
      Edited: Chidiebere Ike
 on 11 Nov 2018
  
			I am using macOS Mojave, version 10.14.1 and my version of Matlab is Matlab_R2017b
  Walter Roberson
      
      
 on 11 Nov 2018
				Which MacOS are you using?
  Chidiebere Ike
 on 11 Nov 2018
				
      Edited: Chidiebere Ike
 on 11 Nov 2018
  
			macOS Mojave, version 10.14.1
  Walter Roberson
      
      
 on 11 Nov 2018
				That version of MATLAB did not support that operating system.
  Chidiebere Ike
 on 11 Nov 2018
				Please, which of these version of Matlab supports my operating system?
MATLAB 9.4(R2018a) or MATLAB 9.5(R2018b)
Thanks
  madhan ravi
      
      
 on 11 Nov 2018
				
      Edited: madhan ravi
      
      
 on 11 Nov 2018
  
			
		
  Chidiebere Ike
 on 11 Nov 2018
				
      Edited: Chidiebere Ike
 on 11 Nov 2018
  
			I have successfully compiled the ompbox and ksvdbox on 2017b Matlab version using Xcode 10 (new release). I still have errors stated below:
if true
  % >> Error using imwrite (line 467)
Unable to open file "Set5/results/baby_GT[1-Original].bmp" for writing.  You might not
have write permission.
Error in Example (line 57)
      imwrite(result(:, :, j), conf.results{i}{j});
>> 
end
  madhan ravi
      
      
 on 11 Nov 2018
				Unable to open file "Set5/results/baby_GT[1-Original].bmp" for writing. You might not have write permission .
  Walter Roberson
      
      
 on 11 Nov 2018
				Directory Set5 or Set5/results might not exist relative to the directory of execution, or directory Set5/results might be one you do not have permission to write into.
  Chidiebere Ike
 on 11 Nov 2018
				Solved. Thanks so much. I appreciate
Answers (0)
See Also
Categories
				Find more on Startup and Shutdown in Help Center and File Exchange
			
	Tags
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!An Error Occurred
Unable to complete the action because of changes made to the page. Reload the page to see its updated state.
Select a Web Site
Choose a web site to get translated content where available and see local events and offers. Based on your location, we recommend that you select: .
You can also select a web site from the following list
How to Get Best Site Performance
Select the China site (in Chinese or English) for best site performance. Other MathWorks country sites are not optimized for visits from your location.
Americas
- América Latina (Español)
- Canada (English)
- United States (English)
Europe
- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)
- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom(English)
Asia Pacific
- Australia (English)
- India (English)
- New Zealand (English)
- 中国
- 日本Japanese (日本語)
- 한국Korean (한국어)


