unofficial mirror of guile-user@gnu.org 
 help / color / mirror / Atom feed
From: David Pirotte <david@altosw.be>
To: Zelphir Kaltstahl <zelphirkaltstahl@gmail.com>
Cc: guile-user@gnu.org
Subject: Re: guile-user Digest, Vol 193, Issue 30
Date: Thu, 27 Dec 2018 02:16:10 -0200	[thread overview]
Message-ID: <20181227021610.6a8904c6@capac> (raw)
In-Reply-To: <6bf4cf28-8063-33a6-7dca-a9759fe71f5b@gmail.com>

[-- Attachment #1: Type: text/plain, Size: 3264 bytes --]

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 #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

  reply	other threads:[~2018-12-27  4:16 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <mailman.89.1545843619.21959.guile-user@gnu.org>
2018-12-26 17:33 ` guile-user Digest, Vol 193, Issue 30 Zelphir Kaltstahl
2018-12-27  4:16   ` David Pirotte [this message]
2018-12-27  5:54     ` David Pirotte

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/guile/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20181227021610.6a8904c6@capac \
    --to=david@altosw.be \
    --cc=guile-user@gnu.org \
    --cc=zelphirkaltstahl@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).