Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

i.svm: Add libsvm-based image classification #2189

Merged
merged 142 commits into from
Jan 9, 2024
Merged
Show file tree
Hide file tree
Changes from 141 commits
Commits
Show all changes
142 commits
Select commit Hold shift + click to select a range
4554c8a
Imagery: move signature files to a <name>/<element> type directory st…
marisn Sep 9, 2021
75c925a
Imagery: correctly free signature list in Python
marisn Sep 9, 2021
5c1a253
i.svm.train: Start of module
marisn Jan 13, 2021
0ab6d44
i.svm: Add LIBSVM to configure system
marisn Jan 19, 2021
eb5badd
i.svm: Training implementation
marisn Jan 19, 2021
f46610e
i.svm.train: Clean up on exit
marisn Jan 28, 2021
74bd394
i.svm.predict: First version of value predicting with SVM
marisn Jan 28, 2021
822615f
i.svm: Implement history tracking and category label preservation
marisn Jan 31, 2021
7eaf408
i.svm: Fix wrapping of transfered command history
marisn Jan 31, 2021
af7dcb9
i.svm: One class classifier gives different values than where present…
marisn Jan 31, 2021
8043cd8
i.svm: Copy colors from training map to prediction map
marisn Jan 31, 2021
d68b34b
Enable compilation of i.svm modules
marisn Mar 29, 2021
95c7eb4
Do not capitalize libsvm
marisn Sep 10, 2021
76bf08d
Imagery: libsvm signature handling
marisn Sep 2, 2021
b7ac7dd
i.svm.train: finalize implementation
marisn Sep 3, 2021
985de22
i.svm: move from element to dir in library calls
marisn Sep 10, 2021
5eb422a
i.svm: updated version of configure
marisn Sep 10, 2021
b8622d9
i.svm.train: move from element to dir in library calls
marisn Sep 10, 2021
c736451
i.svm: prediction code fixes, tests and GUI support
marisn Sep 23, 2021
3d4b339
Merge branch 'main' into i_svm
marisn Feb 11, 2022
138f90c
i.svm: move from bandrefs to semantic labels
marisn Feb 11, 2022
99ed67b
i.svm: add libsvm detection to configure
marisn Feb 11, 2022
6c087f6
i.svm: use raster names if semantic labels are missing (+ formatting …
marisn Feb 11, 2022
e9c5344
i.svm: remove blank line left after merge
marisn Feb 11, 2022
fbe894c
i.svm: add libsvm signatures to GUI as a sigfile choice
marisn Feb 13, 2022
8bd447f
i.svm: rescale imagery group band values to improve prediction
marisn Feb 13, 2022
42631e5
i.svm: Add i.svm modules to GUI menu
marisn Feb 25, 2022
be34ed7
Merge branch 'main' into i_svm
marisn Feb 25, 2022
0200b3c
i.svm: test tests to match new semantic label logic
marisn Feb 25, 2022
6c1ad97
Merge branch 'main' into i_svm
marisn Mar 10, 2022
e544b77
Merge branch 'main' into i_svm
marisn Mar 18, 2022
d9df784
Merge branch 'main' into i_svm
marisn May 27, 2022
ab3ebfc
v.random: do not transfer cat from area if attributes are coppied too
marisn Aug 26, 2022
b1f24de
Merge branch 'main' into v_random_fix_cats
wenzeslaus Aug 28, 2022
2fe0adb
Merge branch 'main' into i_svm
neteler Aug 28, 2022
f149fc9
Merge branch 'v_random_fix_cats' into i_svm
marisn Sep 2, 2022
9b31ab2
i.svm.train: test value rescaling
marisn Sep 9, 2022
3b79cc1
Merge branch 'main' into i_svm
marisn Sep 9, 2022
9291145
Merge branch 'main' into i_svm
marisn Sep 9, 2022
d5f376a
man: allow register all addons keywords in main Keywords Index (#2529)
tmszi Sep 9, 2022
e367946
man: use relative path for core modules man HTML page (#2574)
tmszi Sep 10, 2022
0073c55
avoid using deprecated locale.getdefaultlocale()
pesekon2 Sep 17, 2022
e5fbed6
grass.py: fix missing parameters in gettext.install()
pesekon2 Sep 17, 2022
ed05dcc
wxGUI/forms: fix LayersList widget binding check/uncheck event method…
tmszi Sep 18, 2022
0600823
wxGUI/modules: fix import SQLite geometry data (#2491)
tmszi Sep 19, 2022
ed922a4
general/g.mapsets: fix write MAPSETS without additional empty new lin…
tmszi Sep 21, 2022
14a456a
g.extension: use copytree from shutil for py >= 3.8 (#2592)
ninsbl Oct 2, 2022
391dcbd
SEO and manuals: add viewport and page language (#2591)
neteler Oct 3, 2022
4833a0e
v.out.vtk: Output double data type instead of float (#2562)
wenzeslaus Oct 5, 2022
b69b137
grass.pygrass: VisibleMapset: fix reading search path (#2584)
petrasovaa Oct 6, 2022
a56aa24
init: Fix sudo message on Ubuntu (#2532)
susi Oct 7, 2022
7503a32
contributing: Validate Markdown files
pesekon2 Oct 7, 2022
7bae561
wxGUI: set window offset (OS panel) for single/multiple window mode (…
tmszi Oct 9, 2022
bb29cef
configure: remove unused wxwidgets compilation configuration option (…
sisco0 Oct 9, 2022
9a5f274
utils: fix date and time format retrieved from the module source dir …
tmszi Oct 10, 2022
2deeedd
g.gui.gmodeler: add PyWPS export option
pesekon2 Oct 11, 2022
28c75de
docker ubuntu: update to Ubuntu 22.04 (#2602)
neteler Oct 21, 2022
d6e7849
nsis installer changed SID of grass82.py (#2605)
dnewcomb Oct 22, 2022
68e34f7
utils: module HTML man page use hamburger menu TOC for screen width <…
tmszi Oct 23, 2022
97349a7
t.rast.univar / t.rast3d.univar: Add support for zones (#2588)
ninsbl Oct 24, 2022
86d0e79
wxGUI/modules: fix import PostGIS geometry data (#2490)
tmszi Oct 24, 2022
206ac04
wxGUI/psmap: don't set StatusBar widget text when frame is closed (#2…
tmszi Oct 25, 2022
bece7f7
wxGUI: remove custom v.clean interface to simplify maintenance (#2553)
petrasovaa Oct 26, 2022
569be6c
python/grass/pygrass: reset back MAPSET search path after GridModule …
tmszi Oct 26, 2022
04154b4
wxGUI/gui_core: fix Create or edit image group dialog Select all Chec…
tmszi Oct 27, 2022
8af0fa4
wxGUI: Fix behaviour of top Single-Window GUI toolbars (#2568)
lindakarlovska Oct 28, 2022
602b959
libgrass-interface: Upgrade to ctypesgen v1.1.1 (#2598)
nilason Oct 28, 2022
b4a5c74
g.extension: add tests for download from various sources (#1158)
ninsbl Oct 28, 2022
e23de8d
wxGUI: fix display of all single window mode main toolbar tools (#2617)
tmszi Oct 31, 2022
7022707
wxGUI: fix setting of user defined window position and size for singl…
tmszi Nov 3, 2022
245a166
r.kappa: Fix failures, garbage output, fallback to category values (#…
marisn Nov 3, 2022
cdf42e8
Fix -Wunused-result compiler warnings (#2166)
nilason Nov 6, 2022
2887572
wxGUI: add r.buildvrt module into DevelopRasterMap toolbox (#2621)
tmszi Nov 7, 2022
7fb64da
Fix -Wsometimes-uninitialized compiler warnings (#2165)
nilason Nov 8, 2022
7b21df1
Fix -Wuninitialized compiler warnings (#2164)
nilason Nov 9, 2022
173ae70
v.in.ogr: skip columns with unsupported data type instead of failing …
ninsbl Nov 10, 2022
ef15ddc
v.surf.rst: fix cross-validation and prevent running it multi-threade…
petrasovaa Nov 11, 2022
ec7e8a6
wxGUI: BaseToolbar.OnTool needs to be explicitly defined (#2632)
petrasovaa Nov 11, 2022
ea625ab
utils/g.html2man: don't show mobile TOC menu JS code on cli man page …
tmszi Nov 12, 2022
37893f6
Use GRASS version for non-git builds. (#2636)
sebastic Nov 12, 2022
6571e93
lib config: create dynamic library of C++ libraries (#2612)
nilason Nov 12, 2022
021ec27
t.rast.univar/t.rast3d.univar: add support for multiprocessing (#2624)
ninsbl Nov 14, 2022
9d6bced
grass.pygrass: GridModule clean up temporary mapsets when exception o…
tmszi Nov 15, 2022
8e0eabb
Fix -Wunused-but-set-variable warnings in lib (#2650)
nilason Nov 16, 2022
4f21f6b
Fix -Wparentheses warning (#2652)
nilason Nov 16, 2022
b6ab95a
Fix -Wunused-function compiler warnings (#2163)
nilason Nov 16, 2022
e86f015
Fix -Wunused-variable warnings (#2651)
nilason Nov 16, 2022
fe354c3
Fix -Wmaybe-uninitialized warnings (#2653)
nilason Nov 16, 2022
5f53757
Fix more -Wunused-but-set-variable compiler warnings (#2648)
nilason Nov 17, 2022
e070db5
Fix -Wunneeded-internal-declaration warning (#2654)
nilason Nov 17, 2022
2daeec5
v.in.ogr: handle skipped, not empty columns (#2658)
ninsbl Nov 20, 2022
94468f3
r.in.pdal: Fix use of PDAL 2.4 deprecated api (#2656)
nilason Nov 21, 2022
9008ad1
ci: upgrade to GH Actions running on Node 16 (#2634)
nilason Nov 21, 2022
efe0e71
r3.gwflow: Fix Rast3d_fatal_error() usage (#2597)
BadAssassin Nov 22, 2022
566896b
toolboxes.xml: add r.path (#2655)
pesekon2 Nov 23, 2022
76edd00
lib/raster3d: fix -Wmisleading-indentation warning (#2664)
nilason Nov 24, 2022
e06b493
r.mapcalc: fix -Wunused-variable compiler warning (#2665)
nilason Nov 24, 2022
fbbd3e8
ci: add -Wall to GCC C/C++ standards checks (#2657)
nilason Nov 25, 2022
5403745
lib/imagery: fix -Wfortify-source warning (#2663)
nilason Nov 25, 2022
64d897b
gunittest: remove deprecated 'U'-mode for open() (#2673)
nilason Nov 30, 2022
0bc8a3e
grass.script: replace deprecated use of pipes.quote() (#2674)
nilason Dec 1, 2022
d256aaa
i.svm: avoid warnings if color file is missing
marisn Dec 4, 2022
294bb32
Merge branch 'main' into i_svm
marisn May 19, 2023
6a87958
Clean up bad merge
marisn May 21, 2023
4aa1ca5
i.svm: fix i.svm.predict tests
marisn May 25, 2023
e6581ed
i.svm: implement improvements suggested by linter
marisn Jun 2, 2023
d903eae
Merge branch 'main' into i_svm
marisn Jun 2, 2023
e7021e8
i.svm: unify input parameter naming with other classification modules
marisn Jun 3, 2023
522e9a2
Merge branch 'main' into i_svm
marisn Jul 6, 2023
f2203d0
Merge branch 'main' into i_svm
marisn Aug 15, 2023
9ecbe38
i.svm: fix module descriptions
marisn Aug 21, 2023
f6b7e4b
simplify configure with LIBSVM
nilason Aug 29, 2023
6d4694b
Revert "simplify configure with LIBSVM"
marisn Sep 15, 2023
3b888f7
Improve detection of LIBSVM include path
marisn Sep 15, 2023
56fb5b5
Another attempt at simplifying detection of svm.h file location
marisn Sep 20, 2023
7471a02
i.svm: update copyright year
marisn Sep 22, 2023
2f0e356
Merge branch 'main' into i_svm
marisn Sep 22, 2023
1aa445e
i.svm: include config.h to gain access to location of svm.h file
marisn Sep 22, 2023
209c293
i.svm: fix issues of unclean rebase and related fixes
marisn Sep 28, 2023
bc19802
i.svm: remove unused variable
marisn Sep 28, 2023
55d42ce
i.svm: fix copy/paste error in test case
marisn Sep 28, 2023
e23a8a4
i.svm: remove unused variable
marisn Sep 28, 2023
06ae346
i.svm: update references of related papers
marisn Sep 28, 2023
71049e3
i.svm: fix LIBSVM capitalization
marisn Sep 29, 2023
eb66a19
i.svm: a few more locations requiring capitalization fix
marisn Sep 29, 2023
603b2d2
i.svm: simplify even more LIBSVM header file location (code suggested…
marisn Sep 29, 2023
2c54272
i.svm: limit changes to autoconf files to LIBSVM related lines only
marisn Sep 29, 2023
aed4660
i.svm: fix config.h.in to contain only LIBSVM related changes
marisn Sep 29, 2023
0dfe937
Merge branch 'main' into i_svm
marisn Oct 21, 2023
6e393c5
Merge branch 'main' into i_svm
marisn Oct 25, 2023
e07dc09
i.svm: add libsvm signature files to the signature management tool i.…
marisn Oct 31, 2023
66a640a
i.svm: add missing XML tag to the menu item file
marisn Nov 1, 2023
d4d6975
i.svm: fix examples provided in the documentation
marisn Nov 1, 2023
dad18d9
i.svm: explain meaning of the cache parameter
marisn Nov 10, 2023
bc362bb
i.svm: improve naming of mean normalization variables, move closer
marisn Nov 10, 2023
fb44a67
i.svm: move variables closer to place of their first use (req. of @we…
marisn Nov 10, 2023
49eb47b
i.svm: beautify a long string in python tests
marisn Nov 10, 2023
b8363ac
i.svm: show also in the parameter description that cache is an
marisn Nov 10, 2023
61f6722
Merge branch 'main' into i_svm
wenzeslaus Jan 3, 2024
7f4f4b6
Merge branch 'main' into i_svm
marisn Jan 8, 2024
6dd74df
Regenerate configure with autoconf 2.71
marisn Jan 8, 2024
dc34788
Regenerate configure with stock autoconf
marisn Jan 9, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
205 changes: 203 additions & 2 deletions configure
Original file line number Diff line number Diff line change
Expand Up @@ -679,6 +679,9 @@ CAIROLIB
CAIROINC
CAIRO_HAS_XRENDER_SURFACE
CAIRO_HAS_XRENDER
USE_LIBSVM
LIBSVM_LIB
LIBSVM_INC
LAPACKINC
LAPACKLIB
BLASINC
Expand Down Expand Up @@ -902,6 +905,7 @@ with_odbc
with_fftw
with_blas
with_lapack
with_libsvm
with_cairo
with_freetype
with_nls
Expand Down Expand Up @@ -948,6 +952,8 @@ with_blas_includes
with_blas_libs
with_lapack_includes
with_lapack_libs
with_libsvm_includes
with_libsvm_libs
with_cairo_includes
with_cairo_libs
with_cairo_ldflags
Expand Down Expand Up @@ -1634,6 +1640,7 @@ Optional Packages:
--with-fftw support FFTW functionality (default: yes)
--with-blas support BLAS functionality (default: no)
--with-lapack support LAPACK functionality (default: no)
--with-libsvm support LIBSVM functionality (default: no)
--with-cairo support Cairo functionality (default: yes)
--with-freetype support FreeType functionality (default: yes)
--with-nls support NLS functionality (default: no)
Expand Down Expand Up @@ -1709,6 +1716,9 @@ Optional Packages:
--with-lapack-includes=DIRS
LAPACK include files are in DIRS
--with-lapack-libs=DIRS LAPACK library files are in DIRS
--with-libsvm-includes=DIRS
LIBSVM include files are in DIRS
--with-libsvm-libs=DIRS LIBSVM library files are in DIRS
--with-cairo-includes=DIRS
cairo include files are in DIRS
--with-cairo-libs=DIRS cairo library files are in DIRS
Expand Down Expand Up @@ -4575,7 +4585,7 @@ then :
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $CXX option to enable C++11 features" >&5
printf %s "checking for $CXX option to enable C++11 features... " >&6; }

ac_cv_prog_cxx_11=no
ac_cv_prog_cxx_cxx11=no
nilason marked this conversation as resolved.
Show resolved Hide resolved
ac_save_CXX=$CXX
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
Expand Down Expand Up @@ -4617,7 +4627,7 @@ then :
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $CXX option to enable C++98 features" >&5
printf %s "checking for $CXX option to enable C++98 features... " >&6; }

ac_cv_prog_cxx_98=no
ac_cv_prog_cxx_cxx98=no
nilason marked this conversation as resolved.
Show resolved Hide resolved
ac_save_CXX=$CXX
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
Expand Down Expand Up @@ -5468,6 +5478,17 @@ fi



# Check whether --with-libsvm was given.
if test ${with_libsvm+y}
then :
withval=$with_libsvm;
else $as_nop
with_libsvm=no
fi




# Check whether --with-cairo was given.
if test ${with_cairo+y}
then :
Expand Down Expand Up @@ -5921,6 +5942,25 @@ fi



# Check whether --with-libsvm-includes was given.
if test ${with_libsvm_includes+y}
then :
withval=$with_libsvm_includes;
fi




# Check whether --with-libsvm-libs was given.
if test ${with_libsvm_libs+y}
then :
withval=$with_libsvm_libs;
fi





# Check whether --with-cairo-includes was given.
if test ${with_cairo_includes+y}
then :
Expand Down Expand Up @@ -14519,6 +14559,165 @@ fi # $USE_BLAS

# Done checking LAPACK

# libsvm option
LIBSVM_INC=
LIBSVM_LIB=
USE_LIBSVM=


{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether to use LIBSVM" >&5
printf %s "checking whether to use LIBSVM... " >&6; }
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: \"$with_libsvm\"" >&5
printf "%s\n" "\"$with_libsvm\"" >&6; }
case "$with_libsvm" in
"no") USE_LIBSVM= ;;
"yes") USE_LIBSVM="1" ;;
*) as_fn_error $? "*** You must answer yes or no." "$LINENO" 5 ;;
esac



if test -n "$USE_LIBSVM"; then

{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for location of LIBSVM includes" >&5
printf %s "checking for location of LIBSVM includes... " >&6; }
case "$with_libsvm_includes" in
y | ye | yes | n | no)
as_fn_error $? "*** You must supply a directory to --with-libsvm-includes." "$LINENO" 5
;;
esac
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $with_libsvm_includes" >&5
printf "%s\n" "$with_libsvm_includes" >&6; }

if test -n "$with_libsvm_includes" ; then
for dir in $with_libsvm_includes; do
if test -d "$dir"; then
LIBSVM_INC="$LIBSVM_INC -I$dir"
else
as_fn_error $? "*** LIBSVM includes directory $dir does not exist." "$LINENO" 5
fi
done
fi


ac_save_cppflags="$CPPFLAGS"
CPPFLAGS="$LIBSVM_INC $CPPFLAGS"
for ac_header in svm.h
do :
ac_fn_c_check_header_compile "$LINENO" "svm.h" "ac_cv_header_svm_h" "$ac_includes_default"
if test "x$ac_cv_header_svm_h" = xyes
then :
printf "%s\n" "#define HAVE_SVM_H 1" >>confdefs.h

else $as_nop

ac_save_cppflags="$CPPFLAGS"
CPPFLAGS="$LIBSVM_INC $CPPFLAGS"
for ac_header in libsvm/svm.h
do :
ac_fn_c_check_header_compile "$LINENO" "libsvm/svm.h" "ac_cv_header_libsvm_svm_h" "$ac_includes_default"
if test "x$ac_cv_header_libsvm_svm_h" = xyes
then :
printf "%s\n" "#define HAVE_LIBSVM_SVM_H 1" >>confdefs.h

else $as_nop

as_fn_error $? "*** Unable to locate LIBSVM includes." "$LINENO" 5

fi

done
CPPFLAGS=$ac_save_cppflags


fi

done
CPPFLAGS=$ac_save_cppflags


{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for location of libsvm library" >&5
printf %s "checking for location of libsvm library... " >&6; }
case "$with_libsvm_libs" in
y | ye | yes | n | no)
as_fn_error $? "*** You must supply a directory to --with-libsvm-libs." "$LINENO" 5
;;
esac
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $with_libsvm_libs" >&5
printf "%s\n" "$with_libsvm_libs" >&6; }

if test -n "$with_libsvm_libs"; then
for dir in $with_libsvm_libs; do
if test -d "$dir"; then
LIBSVM_LIB="$LIBSVM_LIB -L$dir"
else
as_fn_error $? "*** libsvm library directory $dir does not exist." "$LINENO" 5
fi
done
fi


ac_save_ldflags="$LDFLAGS"
LDFLAGS="$LIBSVM_LIB $LDFLAGS"


{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for svm_load_model in -lsvm" >&5
printf %s "checking for svm_load_model in -lsvm... " >&6; }

ac_check_lib_save_LIBS=$LIBS
LIBS="-lsvm $LIBS"
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */

/* Override any GCC internal prototype to avoid an error.
Use char because int might match the return type of a GCC
builtin and then its argument prototype would still apply. */
char svm_load_model ();
int
main (void)
{
return svm_load_model ();
;
return 0;
}
_ACEOF
if ac_fn_c_try_link "$LINENO"
then :
ac_cv_lib_svm_svm_load_model=yes
else $as_nop
ac_cv_lib_svm_svm_load_model=no
fi
rm -f core conftest.err conftest.$ac_objext conftest.beam \
conftest$ac_exeext conftest.$ac_ext
LIBS=$ac_check_lib_save_LIBS
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_svm_svm_load_model" >&5
printf "%s\n" "$ac_cv_lib_svm_svm_load_model" >&6; }
if test "x$ac_cv_lib_svm_svm_load_model" = xyes
then :
LIBSVM_LIB="$LIBSVM_LIB -lsvm "
else $as_nop

LDFLAGS=${ac_save_ldflags}

as_fn_error $? "*** Unable to locate LIBSVM library." "$LINENO" 5


fi



LDFLAGS=${ac_save_ldflags}


printf "%s\n" "#define HAVE_LIBSVM 1" >>confdefs.h

fi




# Done with LIBSVM

# Enable Cairo display driver option


Expand Down Expand Up @@ -17436,6 +17635,8 @@ echo " Large File support (LFS): `if test -n "${USE_LARGEFILES}" ; then echo

echo " libLAS support: `if test -n "${USE_LIBLAS}" ; then echo yes ; else echo no ; fi`"

echo " LIBSVM support: `if test -n "${USE_LIBSVM}" ; then echo yes ; else echo no ; fi`"

echo " MySQL support: `if test -n "${USE_MYSQL}" ; then echo yes ; else echo no ; fi`"

echo " NetCDF support: `if test -n "${USE_NETCDF}" ; then echo yes ; else echo no ; fi`"
Expand Down
27 changes: 27 additions & 0 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -296,6 +296,7 @@ LOC_ARG_WITH(odbc, ODBC, no)
LOC_ARG_WITH(fftw, FFTW)
LOC_ARG_WITH(blas, BLAS, no)
LOC_ARG_WITH(lapack, LAPACK, no)
LOC_ARG_WITH(libsvm, LIBSVM, no)
LOC_ARG_WITH(cairo, Cairo)
LOC_ARG_WITH(freetype, FreeType)
LOC_ARG_WITH(nls, NLS, no)
Expand Down Expand Up @@ -385,6 +386,9 @@ LOC_ARG_WITH_LIB(blas, BLAS)
LOC_ARG_WITH_INC(lapack, LAPACK)
LOC_ARG_WITH_LIB(lapack, LAPACK)

LOC_ARG_WITH_INC(libsvm, LIBSVM)
LOC_ARG_WITH_LIB(libsvm, LIBSVM)

LOC_ARG_WITH_INC(cairo, cairo)
LOC_ARG_WITH_LIB(cairo, cairo)
LOC_ARG_WITH_LDFLAGS(cairo, cairo)
Expand Down Expand Up @@ -1696,6 +1700,28 @@ AC_SUBST(LAPACKINC)

# Done checking LAPACK

# libsvm option
LIBSVM_INC=
LIBSVM_LIB=
USE_LIBSVM=

LOC_CHECK_USE(libsvm,LIBSVM,USE_LIBSVM)

if test -n "$USE_LIBSVM"; then
LOC_CHECK_INC_PATH(libsvm,LIBSVM,LIBSVM_INC)
LOC_CHECK_INCLUDES(svm.h,LIBSVM,$LIBSVM_INC, [
LOC_CHECK_INCLUDES(libsvm/svm.h,LIBSVM,$LIBSVM_INC)
])
LOC_CHECK_LIB_PATH(libsvm,libsvm,LIBSVM_LIB)
LOC_CHECK_LIBS(svm,svm_load_model,LIBSVM,$LIBSVM_LIB,LIBSVM_LIB,,,)
AC_DEFINE(HAVE_LIBSVM, 1, [Define to 1 if using LIBSVM.])
fi

AC_SUBST(LIBSVM_INC)
AC_SUBST(LIBSVM_LIB)
AC_SUBST(USE_LIBSVM)
# Done with LIBSVM

# Enable Cairo display driver option

LOC_CHECK_USE(cairo,Cairo,USE_CAIRO)
Expand Down Expand Up @@ -2022,6 +2048,7 @@ LOC_MSG_USE(GEOS support,USE_GEOS)
LOC_MSG_USE(LAPACK support,USE_LAPACK)
LOC_MSG_USE(Large File support (LFS), USE_LARGEFILES)
LOC_MSG_USE(libLAS support,USE_LIBLAS)
LOC_MSG_USE(LIBSVM support,USE_LIBSVM)
LOC_MSG_USE(MySQL support,USE_MYSQL)
LOC_MSG_USE(NetCDF support,USE_NETCDF)
LOC_MSG_USE(NLS support,USE_NLS)
Expand Down
7 changes: 5 additions & 2 deletions gui/wxpython/gui_core/gselect.py
Original file line number Diff line number Diff line change
Expand Up @@ -3096,7 +3096,7 @@ def __init__(
def UpdateItems(self, element):
"""Update list of signature files for given element

:param str element: signatures/sig or signatures/sigset
:param str element: signatures/sig, signatures/sigset or signatures/libsvm
"""
items = []
if self.mapsets:
Expand All @@ -3120,6 +3120,7 @@ def _append_mapset_signatures(self, mapset, element, items):
from grass.lib.imagery import (
I_SIGFILE_TYPE_SIG,
I_SIGFILE_TYPE_SIGSET,
I_SIGFILE_TYPE_LIBSVM,
I_signatures_list_by_type,
I_free_signatures_list,
)
Expand All @@ -3133,6 +3134,8 @@ def _append_mapset_signatures(self, mapset, element, items):
sig_type = I_SIGFILE_TYPE_SIG
elif element == "signatures/sigset":
sig_type = I_SIGFILE_TYPE_SIGSET
elif element == "signatures/libsvm":
sig_type = I_SIGFILE_TYPE_LIBSVM
else:
return
list_ptr = ctypes.POINTER(ctypes.c_char_p)
Expand All @@ -3151,7 +3154,7 @@ def __init__(
):
super().__init__(parent, id, size=size, **kwargs)
self.SetName("SignatureTypeSelect")
self.SetItems(["sig", "sigset"])
self.SetItems(["sig", "sigset", "libsvm"])


class SeparatorSelect(wx.ComboBox):
Expand Down
7 changes: 7 additions & 0 deletions gui/wxpython/xml/toolboxes.xml
Original file line number Diff line number Diff line change
Expand Up @@ -1559,6 +1559,13 @@
<label>Sequential maximum a posteriori classification (SMAP)</label>
</module-item>
<separator/>
<module-item name="i.svm.train">
<label>Input for supervised SVM</label>
</module-item>
<module-item name="i.svm.predict">
<label>Support Vector Machines classification (SVM)</label>
</module-item>
<separator/>
<module-item name="i.signatures">
<label>Manage signature files</label>
</module-item>
Expand Down
2 changes: 2 additions & 0 deletions imagery/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@ SUBDIRS = \
i.segment \
i.signatures \
i.smap \
i.svm.predict \
i.svm.train \
i.target \
i.topo.corr \
i.pca \
Expand Down
Loading
Loading