guile-user
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: guile-user Digest, Vol 193, Issue 30


From: David Pirotte
Subject: Re: guile-user Digest, Vol 193, Issue 30
Date: Thu, 27 Dec 2018 02:16:10 -0200

Hi Zelphir,

> >     AIscm
> >     http://wedesoft.github.io/aiscm

> Thanks David,

You are welcome!

> I've added these to my notes for further investigation : )

> In SciPy and if I am not mistaken in the Python bindings for OpenCV they
> also use NumPy ndarray to represent images and it feels quite natural,
> so it makes sense to me to use n-dimensional arrays for this.

Note that when I'm saying that images are a collection of n-dim arrays, I am
referring to the 'human representation' of things: all (fast) image library 
that I'm
aware of internally use homogeneous vectors to store image channels.

> It seems the "uniform numeric vectors" of Guile are an implementation of
> the vectors in SRFI-4 as per:
> https://www.gnu.org/software/guile/manual/html_node/Uniform-Numeric-Vectors.html#Uniform-Numeric-Vectors.

Afaict, in Guile, there is no other "uniform numeric vectors" implementation 
then
the one specified in (srfi srfi-4).

> So far I have a very naive but working matrix operation implementation
> here (WIP):

> https://gitlab.com/ZelphirKaltstahl/neural-network/blob/dev/matrix.scm

Hum, neural network ... you definitely  want to consider using AIscm instead, 
which
just added a binding to the tensor flow library:

        https://lists.gnu.org/archive/html/guile-user/2018-12/msg00070.html

        [ this email includes a detailed (well commented) example of a
        [ (very) famous (basic) example of NN training in the NN world ...

> I think, once I have a good idea about how to use a fitting library or
> how to interface with a library of another programming language, I
> should be able to switch ...

You should consider using one of the libs I 'linked' in my previous message, and
given your objective is NN, iiuc, AIscm (and Guile-CV - but it does not have a
NN lib binding yet) probably are your friends here ...

> Yesterday I tried to use my transpose procedure and it turns out I
> sooner run out of RAM (8GB) than the thing slows down ...
>...

Guile-CV is fast (as fast as, sometime a lot faster then InageJ [1], which, with
OpenCV, is a reference in the image processing and analysis world).  However, it
will never reach the performance offered by libs that uses GPU (such as 
tensorflow
just to name one).

Now, using Guile-CV, on my relatively slow laptop (i5-2450M CPU @ 2.50GHz × 4 - 
6GB
RAM):

        scheme@(guile-user)> ,use (cv)

        scheme@(guile-user)> (im-make 1000 1000 1)
        $5 = (1000 1000 1 (#f32(0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 
0.0 # …)))

        scheme@(guile-user)> ,time (im-transpose $5)
        $6 = (1000 1000 1 (#f32(0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 
0.0 # …)))
        ;; 0.342220s real time, 0.367022s run time.  0.040217s spent in GC.

        scheme@(guile-user)> (im-make 1000 10000 1)
        $7 = (1000 10000 1 (#f32(0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 
0.0 0.0 # …)))

        scheme@(guile-user)> ,time (im-transpose $7)
        $8 = (10000 1000 1 (#f32(0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 
0.0 0.0 # …)))
        ;; 3.186683s real time, 3.374562s run time.  0.303187s spent in GC.

But I see that im-transpose still is pure scheme code, I'll write the low level
operation in C and post back ...

Cheers,
David

[1]     https://imagej.nih.gov/ij/

Attachment: pgp9t1MjN5MLD.pgp
Description: OpenPGP digital signature


reply via email to

[Prev in Thread] Current Thread [Next in Thread]