Skip to content

haldai/LogicalVision2

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

61 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

LogicalVision2

Symbolic computer vision tool with SWI-Prolog and OpenCV.

Requirement

  1. SWI-Prolog (>=7.0) compiled with EXTRA_PKGS=clib and multi-threading enabled, better using swipl-devel.

  2. OpenCV4. If you installed it with pacman -S opencv under Archlinux, please also install vtk package.

  3. Armadillo library for matrix handling.

  4. Machine learning library mlpack.

  5. [Optional] Qt5 if you want a moderner OpenCV displaying, complile your OpenCV with Qt option on.

Compile

cd src/ && make -j$nproc

Usage

After compilation you will get cvio.so, cvdraw.so, cvsampler.so cvstats.so in libs folder. Simply load them in SWI-Prolog with:

load_foreign_library(foreign('libs/cvio.so')).
load_foreign_library(foreign('libs/cvsampler.so')).
load_foreign_library(foreign('libs/cvdraw.so')).
load_foreign_library(foreign('libs/cvstats.so')).

Please see the source codes for detail predicates.

Example

The first example is about video I/O:

?- load_foreign_library(foreign('libs/cvio.so')).
?- load_video('../../data/Protist.mp4', A), showvid_win(A, debug).

During video playing, press ESC to quit, any other key to pause.

The second example learns ambiguity from a crater image:

cd src/learning
swipl ambiguity.pl
?- a.

If the code is built, you should firstly see an image of the crater with 4 abduced theories.

The third example learns the background knowledge of lighting w.r.t. convexity for ambiguity abduction:

cd src/learning
swipl light.pl
?- a('01001').

The output should be a learned logic program of lighting, however the learning is based on random samplings of low-level features, so sometime the output would be nothing. In this case, please try again.

Further details

Wang-Zhou Dai, Stephen H. Muggleton, and Zhi-Hua Zhou. Logical Vision: Meta-interpretive learning for simple geometrical concepts. In Late Breaking Paper Proceedings of the 25th International Conference on Inductive Logic Programming, pages 1–16. CEUR, 2015.

Wang-Zhou Dai and Zhi-Hua Zhou. Combining logic abduction and statistical induction: Discovering written primitives with human knowledge. In Proceedings of the 31st AAAI Conference on Artificial Intelligence (AAAI'17), San Francisco, CA, 2017.

Contact

Wang-Zhou Dai

LAMDA Group, Nanjing University

daiwz@lamda.nju.edu.cn

http://lamda.nju.edu.cn/daiwz

License

The code is protected by GPLv3.

Releases

No releases published

Packages

No packages published

Languages