permfl / dictlearn Goto Github PK
View Code? Open in Web Editor NEWDictionary Learning for image processing
Home Page: http://dictlearn.readthedocs.io/
Dictionary Learning for image processing
Home Page: http://dictlearn.readthedocs.io/
Hi, I encountered the following error when importing dictlearn. I have tried to reinstall the package in setup.py but still not working.
import dictlearn
Traceback (most recent call last):
File "/Users/zitongyang/Documents/overcomplete/experiments/dictlearn/dictlearn/__init__.py", line 84, in <module>
___SETUP___
NameError: name '___SETUP___' is not defined
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/Users/zitongyang/Documents/overcomplete/experiments/dictlearn/dictlearn/__init__.py", line 92, in <module>
from .algorithms import (
File "/Users/zitongyang/Documents/overcomplete/experiments/dictlearn/dictlearn/algorithms.py", line 6, in <module>
from . import optimize, inpaint, sparse
File "/Users/zitongyang/Documents/overcomplete/experiments/dictlearn/dictlearn/optimize.py", line 10, in <module>
from . import sparse, preprocess
File "/Users/zitongyang/Documents/overcomplete/experiments/dictlearn/dictlearn/sparse.py", line 13, in <module>
from ._dictlearn import _dictlearn
File "/Users/zitongyang/Documents/overcomplete/experiments/dictlearn/dictlearn/_dictlearn/__init__.py", line 1, in <module>
from . import _dictlearn
ImportError: cannot import name '_dictlearn' from 'dictlearn._dictlearn' (/Users/zitongyang/Documents/overcomplete/experiments/dictlearn/dictlearn/_dictlearn/__init__.py)
I am having trouble with dl.ksvd
, using the tutorial code below (trying to train on my own image - 'image_rescaled'). Here is my code:
1. image_patches = dl.Patches(image_rescaled.astype(float), 8)
2. dictionary_a = dl.dct_dict(256, 8)
3. dictionary_b = dl.ksvd(image_patches, dictionary_a, 1, n_nonzero=8, n_threads=4, verbose=True)
4. dl.visualize_dictionary(dictionary_b, 16, 16)
And the error:
AttributeError: 'tuple' object has no attribute 'shape'
The problem occurs when I try visualize_dictionary
, but changing line 4 to:
dl.visualize_dictionary(dictionary_b[0], 16, 16)
solves this problem. The code looks fine but the tutorial is a bit misleading - since dictionary_a is not the same as dictionary_b (dictionary_b is a tuple).
When i attempt to import dictlearn using python 2.7 I get the following error:
Python 2.7.16 |Anaconda, Inc.| (default, Aug 22 2019, 16:00:36)
[GCC 7.3.0] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import dictlearn as dl
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "dictlearn/__init__.py", line 92, in <module>
from .algorithms import (
File "dictlearn/algorithms.py", line 6, in <module>
from . import optimize, inpaint, sparse
File "dictlearn/optimize.py", line 10, in <module>
from . import sparse, preprocess
File "dictlearn/sparse.py", line 13, in <module>
from ._dictlearn import _dictlearn
File "dictlearn/_dictlearn/__init__.py", line 1, in <module>
from . import _dictlearn
ImportError: cannot import name _dictlearn
Any advice you can give for resolving this issue would be greatly appreciated.
Thanks
Hi, I am getting the same error after running import dictlearn
. I install the package using python setup.py install
and tried with python setup.py build_ext
but still gives an error.
---------------------------------------------------------------------------
NameError Traceback (most recent call last)
/content/dictlearn/dictlearn/__init__.py in <module>()
83 try:
---> 84 ___SETUP___
85 print('Installing dictlearn...')
NameError: name '___SETUP___' is not defined
<ipython-input-5-e8373b45b542> in <module>()
----> 1 import dictlearn
/content/dictlearn/dictlearn/__init__.py in <module>()
90 #### TODO ####
91 # Speed up imports: This is way to slow!
---> 92 from .algorithms import (
93 Trainer, ImageTrainer, Denoise, Inpaint, ksvd_denoise
94 )
/content/dictlearn/dictlearn/algorithms.py in <module>()
4 import math
5 import numpy as np
----> 6 from . import optimize, inpaint, sparse
7 from .preprocess import Patches
8 from .utils import dct_dict, random_dictionary, imread
/content/dictlearn/dictlearn/optimize.py in <module>()
8 from scipy import linalg
9
---> 10 from . import sparse, preprocess
11
12 """
/content/dictlearn/dictlearn/sparse.py in <module>()
11 from . import filters
12 from . import preprocess
---> 13 from ._dictlearn import _dictlearn
14
15
/content/dictlearn/dictlearn/_dictlearn/__init__.py in <module>()
----> 1 from . import _dictlearn
2 from . import hessian
ImportError: cannot import name '_dictlearn'
Originally posted by @JorgeNustes in #2 (comment)
I tried to install the module via the two lines of code below:
$ pip install -r requirements.txt
$ python setup.py install
but got the following error after the second line (running setup.py install):
...
creating build/temp.macosx-10.7-x86_64-3.6/Users/alexandrasmith/Documents/Socos_Labs/Diabetes/Modeling/dictlearn/dictlearn/_dictlearn
gcc -Wno-unused-result -Wsign-compare -Wunreachable-code -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -I/Applications/anaconda3/include -arch x86_64 -I/Applications/anaconda3/include -arch x86_64 -Idictlearn/_dictlearn -I/Applications/anaconda3/lib/python3.6/site-packages/numpy/core/include -I/Applications/anaconda3/include/python3.6m -c /Users/alexandrasmith/Documents/Socos_Labs/Diabetes/Modeling/dictlearn/dictlearn/_dictlearn/_dictlearn.c -o build/temp.macosx-10.7-x86_64-3.6/Users/alexandrasmith/Documents/Socos_Labs/Diabetes/Modeling/dictlearn/dictlearn/_dictlearn/_dictlearn.o -fopenmp -O3
clang: error: unsupported option '-fopenmp'
error: command 'gcc' failed with exit status 1
Any suggestions? I am looking to find a module or open-sourced implementation of a sparse dictionary learning algorithm, and yours looks great--I'd love use it.
Hi, I encountered the following error when importing dictlearn. I have tried to reinstall the package with
python setup.py install
and python setup.py build_ext
but still gives an error.
import dictlearn
Traceback (most recent call last):
File "/home/david/dictlearn/src/dictlearn/dictlearn/__init__.py", line 84, in <module>
___SETUP___
NameError: name '___SETUP___' is not defined
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "<ipython-input-7-e8373b45b542>", line 1, in <module>
import dictlearn
File "/home/david/dictlearn/src/dictlearn/dictlearn/__init__.py", line 92, in <module>
from .algorithms import (
File "/home/david/dictlearn/src/dictlearn/dictlearn/algorithms.py", line 6, in <module>
from . import optimize, inpaint, sparse
File "/home/david/dictlearn/src/dictlearn/dictlearn/optimize.py", line 10, in <module>
from . import sparse, preprocess
File "/home/david/dictlearn/src/dictlearn/dictlearn/sparse.py", line 13, in <module>
from ._dictlearn import _dictlearn
File "/home/david/dictlearn/src/dictlearn/dictlearn/_dictlearn/__init__.py", line 1, in <module>
from . import _dictlearn
ImportError: /home/david/dictlearn/src/dictlearn/dictlearn/_dictlearn/_dictlearn.cpython-36m-x86_64-linux-gnu.so: undefined symbol: omp_get_thread_num
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.