tiepvupsu / DICTOL_python

A Python implementation of well-known dictionary learning methods.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Folder 'data' not installing

SimonRuetz opened this issue · comments

import dictol
dictol.demo()

================================================================
Mini Unit test: Sparse Representation-based Classification (SRC)
Traceback (most recent call last):
File "lib/python3.8/site-packages/scipy/io/matlab/mio.py", line 39, in _open_file
return open(file_like, mode), True
FileNotFoundError: [Errno 2] No such file or directory: 'lib/python3.8/site-packages/dictol/data/myYaleB.mat'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "", line 1, in
File "/lib/python3.8/site-packages/dictol/init.py", line 5, in demo
SRC.mini_test_unit()
File "/lib/python3.8/site-packages/dictol/SRC.py", line 39, in mini_test_unit
Y_train, Y_test, label_train, label_test = utils.train_test_split(dataset, N_train)
File "/lib/python3.8/site-packages/dictol/utils.py", line 413, in train_test_split
Y_train, label_train, Y_test, label_test = picl_train_test(dataset, N_train)
File "/lib/python3.8/site-packages/dictol/utils.py", line 299, in picl_train_test
vars_dict = load_mat(data_fn)
File "/lib/python3.8/site-packages/dictol/utils.py", line 294, in load_mat
return sio.loadmat(filename)
File "/lib/python3.8/site-packages/scipy/io/matlab/mio.py", line 216, in loadmat
with _open_file_context(file_name, appendmat) as f:
File "/lib/python3.8/contextlib.py", line 113, in enter
return next(self.gen)
File "/lib/python3.8/site-packages/scipy/io/matlab/mio.py", line 19, in _open_file_context
f, opened = _open_file(file_like, appendmat, mode)
File "/lib/python3.8/site-packages/scipy/io/matlab/mio.py", line 45, in _open_file
return open(file_like, mode), True
FileNotFoundError: [Errno 2] No such file or directory: '~/lib/python3.8/site-packages/dictol/data/myYaleB.mat'

As suggested 'pip install dictol' was used. Somehow the 'data' folder with myYaleB.mat does not install properly.

Thank you for pointing this out. While waiting for the fix, you can clone this repo directly or get the data folder at https://github.com/tiepvupsu/DICTOL_python/tree/master/dictol/data.

Thanks for the quick reply and the great package :)
I also noticed another error:

dictol.demo()

================================================================
Mini Unit test: Sparse Representation-based Classification (SRC)
Traceback (most recent call last):
File "", line 1, in
File "lib/python3.8/site-packages/dictol/init.py", line 5, in demo
SRC.mini_test_unit()
File "lib/python3.8/site-packages/dictol/SRC.py", line 39, in mini_test_unit
Y_train, Y_test, label_train, label_test = utils.train_test_split(dataset, N_train)
File "lib/python3.8/site-packages/dictol/utils.py", line 413, in train_test_split
Y_train, label_train, Y_test, label_test = picl_train_test(dataset, N_train)
File "lib/python3.8/site-packages/dictol/utils.py", line 306, in picl_train_test
Y_range = vars_dict['Y_range'].flatten(1).astype(int)
ValueError: Non-string object detected for the array ordering. Please pass in 'C', 'F', 'A', or 'K' instead

I think flatten(1) in utils.py is not supported in the most current numpy version. I changed it locally to flatten() and now it seems to work