[mlpack] Loading Images, Issues

Adithya Praveen adithyatp at yahoo.com
Tue Jan 7 03:59:47 EST 2020


 Hi Ryan,
Thanks for all the info. Super useful stuff!
> When you compile mlpack, you'll need to make sure that the STB library
> is found.  You can see the output when you run cmake.  Actually, CMake  
> should download STB if it's not available---so, it sounds like maybe you
> have installed mlpack from the package manager, and perhaps the package
> manager you installed from did not have that support.  You might have to
> compile it yourself then.
1. I removed all previous remnants of mlpack and compiled mlpack myself without a package manager, just like you suggested. And just like you said, CMake detected the abscence of STB_IMAGE, and downloaded it. However, the issue persists. Here is the output generated when I ran CMake, it might help identify the issue.
-- The C compiler identification is GNU 7.4.0-- The CXX compiler identification is GNU 7.4.0-- Check for working C compiler: /usr/bin/cc-- Check for working C compiler: /usr/bin/cc -- works-- Detecting C compiler ABI info-- Detecting C compiler ABI info - done-- Detecting C compile features-- Detecting C compile features - done-- Check for working CXX compiler: /usr/bin/c++-- Check for working CXX compiler: /usr/bin/c++ -- works-- Detecting CXX compiler ABI info-- Detecting CXX compiler ABI info - done-- Detecting CXX compile features-- Detecting CXX compile features - done-- cotire 1.7.10 loaded.-- Looking for pthread.h-- Looking for pthread.h - found-- Performing Test CMAKE_HAVE_LIBC_PTHREAD-- Performing Test CMAKE_HAVE_LIBC_PTHREAD - Failed-- Looking for pthread_create in pthreads-- Looking for pthread_create in pthreads - not found-- Looking for pthread_create in pthread-- Looking for pthread_create in pthread - found-- Found Threads: TRUE  -- Found Armadillo: /usr/lib/x86_64-linux-gnu/libarmadillo.so (found suitable version "9.800.3", minimum required is "8.400.0") -- Armadillo libraries: /usr/lib/x86_64-linux-gnu/libarmadillo.so-- Could NOT find STB_IMAGE (missing: STB_IMAGE_INCLUDE_DIR) -- [download 100% complete]-- [download 0% complete]-- [download 6% complete]-- [download 12% complete]-- [download 19% complete]-- [download 25% complete]-- [download 31% complete]-- [download 37% complete]-- [download 44% complete]-- [download 50% complete]-- [download 56% complete]-- [download 62% complete]-- [download 68% complete]-- [download 75% complete]-- [download 81% complete]-- [download 87% complete]-- [download 93% complete]-- [download 100% complete]-- [download 100% complete]-- [download 0% complete]-- [download 25% complete]-- [download 49% complete]-- [download 74% complete]-- [download 98% complete]-- [download 100% complete]-- Successfully downloaded stb into /home/adi/mlpack-3.2.1/build/deps/stb/-- Could NOT find Ensmallen (missing: ENSMALLEN_INCLUDE_DIR) (Required is at least version "2.10.0")-- [download 1% complete]-- [download 2% complete]-- [download 3% complete]-- [download 4% complete]-- [download 5% complete]-- [download 6% complete]-- [download 7% complete]-- [download 8% complete]-- [download 9% complete]-- [download 10% complete]-- [download 11% complete]-- [download 12% complete]-- [download 13% complete]-- [download 14% complete]-- [download 15% complete]-- [download 16% complete]-- [download 17% complete]-- [download 18% complete]-- [download 19% complete]-- [download 20% complete]-- [download 21% complete]-- [download 22% complete]-- [download 23% complete]-- [download 24% complete]-- [download 25% complete]-- [download 26% complete]-- [download 27% complete]-- [download 28% complete]-- [download 29% complete]-- [download 30% complete]-- [download 31% complete]-- [download 32% complete]-- [download 33% complete]-- [download 34% complete]-- [download 35% complete]-- [download 36% complete]-- [download 38% complete]-- [download 39% complete]-- [download 40% complete]-- [download 42% complete]-- [download 43% complete]-- [download 44% complete]-- [download 46% complete]-- [download 47% complete]-- [download 48% complete]-- [download 50% complete]-- [download 51% complete]-- [download 52% complete]-- [download 53% complete]-- [download 54% complete]-- [download 55% complete]-- [download 56% complete]-- [download 57% complete]-- [download 58% complete]-- [download 59% complete]-- [download 60% complete]-- [download 61% complete]-- [download 62% complete]-- [download 63% complete]-- [download 64% complete]-- [download 65% complete]-- [download 66% complete]-- [download 67% complete]-- [download 68% complete]-- [download 69% complete]-- [download 70% complete]-- [download 71% complete]-- [download 72% complete]-- [download 73% complete]-- [download 74% complete]-- [download 75% complete]-- [download 76% complete]-- [download 77% complete]-- [download 78% complete]-- [download 79% complete]-- [download 80% complete]-- [download 81% complete]-- [download 82% complete]-- [download 83% complete]-- [download 84% complete]-- [download 85% complete]-- [download 86% complete]-- [download 87% complete]-- [download 88% complete]-- [download 89% complete]-- [download 90% complete]-- [download 91% complete]-- [download 92% complete]-- [download 93% complete]-- [download 94% complete]-- [download 95% complete]-- [download 96% complete]-- [download 97% complete]-- [download 98% complete]-- [download 99% complete]-- [download 100% complete]-- Successfully downloaded ensmallen into /home/adi/mlpack-3.2.1/build/deps/ensmallen-2.10.3/-- Found Boost: /usr/include (found suitable version "1.65.1", minimum required is "1.49") found components:  program_options unit_test_framework serialization -- Found OpenMP_C: -fopenmp (found version "4.5") -- Found OpenMP_CXX: -fopenmp (found version "4.5") -- Found OpenMP: TRUE (found version "4.5")  -- Found Git: /usr/bin/git (found version "2.17.1") -- Regenerating arma_config.hpp.CMake Warning at CMakeLists.txt:570 (message):  txt2man not found; man pages will not be generated.

-- Not building Markdown bindings.-- Found PythonInterp: /usr/bin/python (found version "2.7.15") -- Found Python: /usr/bin/python-- Found PY_distutils: /usr/lib/python2.7/distutils  -- Found PY_Cython: /usr/local/lib/python2.7/dist-packages/Cython-0.29.13-py2.7-linux-x86_64.egg/Cython  -- Found PY_numpy: /home/adi/.local/lib/python2.7/site-packages/numpy  -- Found PY_pandas: /usr/lib/python2.7/dist-packages/pandas  -- Performing Test COMPILER_HAS_HIDDEN_VISIBILITY-- Performing Test COMPILER_HAS_HIDDEN_VISIBILITY - Success-- Performing Test COMPILER_HAS_HIDDEN_INLINE_VISIBILITY-- Performing Test COMPILER_HAS_HIDDEN_INLINE_VISIBILITY - Success-- Performing Test COMPILER_HAS_DEPRECATED_ATTR-- Performing Test COMPILER_HAS_DEPRECATED_ATTR - Success-- CXX target mlpack cotired.-- CXX target mlpack_test cotired.-- Could NOT find Doxygen (missing: DOXYGEN_EXECUTABLE) -- Found PkgConfig: /usr/bin/pkg-config (found version "0.29.1") -- Configuring done-- Generating done-- Build files have been written to: /home/adi/mlpack-3.2.1/build


I tried commenting out the "throw runtime error" bit in the "load image" definition. This time the program ran, and I tried printing out the contents of "image info". It only detected that "channels=3", and did not detect height or width (both of which equals zero, when printed out). If your require my code, it can be found at the end of issue 35 (https://github.com/mlpack/models/issues/35)

2. I want to keep a separate thread for my doubts with regard to updating the documentation. So I'll be sending a different email to ask my doubts.Thanks for the link to the documentation for loading images.
Again, for the STB ISSUE, I suspect I need to export some environment variable initialized with the path to the stb library. If that's that case, I do not know the name of that environment variable that needs to be exported. Maybe, CMake already takes care of everything in that respect, and I'm missing the reason behind the error altogether. 
Thank you for all the pointers you gave me in the previous email !
Cheers, Adi.        On Tuesday, January 7, 2020, 7:24:53 AM GMT+4, Ryan Curtin <ryan at ratml.org> wrote:  
 
 On Mon, Jan 06, 2020 at 01:23:24PM +0000, Adithya Praveen wrote:
> Hey there I'm Adi !
> I've been tinkering around with mlpack for a couple days now. I've got
> a few things on my mind, and it would be really helpful if someone
> could guide me on these. a

Hi Adi,

Thanks for getting in touch.  I'll try my best to answer all three
points. :)

> 1. I see that the support for loading images was recently added to
> mlpack (I saw this on issue 1903).    Kudos on that contribution!
> However, i keep getting this error:        terminate called after
> throwing an instance of 'std::runtime_error'      what():  Load():
> HAS_STB is not defined, so STB is not available and images cannot be
> loaded!
>     Any help on how to resolve this issue would be very helpful.

When you compile mlpack, you'll need to make sure that the STB library
is found.  You can see the output when you run cmake.  Actually, CMake
should download STB if it's not available---so, it sounds like maybe you
have installed mlpack from the package manager, and perhaps the package
manager you installed from did not have that support.  You might have to
compile it yourself then.

> 2. Issue 1903 states that documentation has been added for loading
> images (on the checklist at the top of this issue).    However, I'm
> having a hard time finding this documentation. If anyone could point
> me towards those resources, that    would be helpful.

Oh, I see... there is a tutorial in doc/tutorials/image/image.txt, but
that was never added to the list of tutorials in mlpack/core.hpp or
anywhere else, so the website doesn't link to it.  Here's a direct link
to that tutorial:

https://www.mlpack.org/doc/mlpack-3.2.2/doxygen/imagetutorial.html

>     I would also like to add that I would be happy to add this
> documentation myself if such documentation does not exists,     once I
> understand the reason behind 1 (referring to point 1 described above).

Yeah, if you want to update the Doxygen documentation to fix this, that
would be great!

> 3. I have proposed a solution to the issue stated in 2138 with regard
> to the DecisionTree classifier. Again, it would be great    if anyone
> could give their comments on my reply to the issue, and that if it
> resolves the issue itself. Cheers,Adi.

Glancing at your answer, that's roughly what I would have suggested. :)
Both the mlpack_hoeffding_tree and mlpack_decision_tree command-line
bindings (or Python/Julia bindings) should be able to work with that
data, but manually encoding them as integers should be fine too.  To
load categorical data like that, you can use the overload of
data::Load() that takes a DatasetInfo, which will store information on
the dimensions that are categorical and numeric.

Hope this helps!

Thanks,

Ryan

-- 
Ryan Curtin    | "I'm so likable!"
ryan at ratml.org |  - Frank
  
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://knife.lugatgt.org/pipermail/mlpack/attachments/20200107/faff73a1/attachment-0001.htm>


More information about the mlpack mailing list