AILab – scripting language for Artificial Intelligence - Giga-Software

trampknowledgeSoftware and s/w Development

Nov 4, 2013 (3 years and 8 months ago)

145 views

AILab – scripting language for Artificial Intelligence

Budisteanu Ionut Alexandru
1
/
44
www.giga-software.com
Grup scolar Oltchim
2011-2012
Ionut Alexandru Budisteanu
Grup Scolar Oltchim

www.giga-software.com


www.seewithtongue.info

Ferdinand Street no 22, Ramnicu Valcea, 240156, Valcea, Romania
AILab – scripting language for

Artificial Intelligence
Budisteanu Ionut Alexandru
Birthday: 01/12/1993
High school: Grup Scolar Oltchim
Ferdinand Street, no 22, Ramnicu Valcea, 240156, Valcea, Romania
AILab – scripting language for Artificial Intelligence
AILab – Scripting language for Artificial Intelligence
It’s a programming language (scripting) conceived by me, which allows creation of minimal applications

oriented for Artificial Intelligence. The software is an

interpreter
; the language syntax is similarly with C. The

software is oriented for templates and the programmer can override methods for a feature development.
The software contains many Artificial Intelligence paradigms:
·
Neural network
·
Genetics algorithm
·
Fuzzy te
chniques
·
Logical programming
The software can generate a Dynamic Link Library which contains the source code in language. It can be

imported in any programming language under Windows Platform. The software is intended to be a tool for

programmers, researchers and software companies such as MatLab. The programmer can write something in

AILab and the software can import source(which is written in AILab) in any programming

language(Environments) as a DLL for a feature development.
The software contains Artificial Intelligence paradigms and procedural programming (Top-Down) and you can

easily write software with AI. You can write
recursive

functions.

Budisteanu Ionut Alexandru
2
/
44
www.giga-software.com
Grup scolar Oltchim
AILab – scripting language for Artificial Intelligence
Visual editor
Software tries to be a visual Integrated Development Environment which can create easily Win32API

applications. The programmer can drag the visual objects and drop into forms, resize objects, object inspector (to

modify object properties). Software uses Run Time Type Information (from Reflection) from Delphi to create

visual Win32API interfaces.
Software is oriented for Rapid Application Development.
Automatically, visual objects added by programmer are written
Into a file with *.aidc(AILab Design Code) extension

Budisteanu Ionut Alexandru
3
/
44
www.giga-software.com
Grup scolar Oltchim
AILab – scripting language for Artificial Intelligence
Intelligenc
e – Autocomplete
.
For

ease

of programming
,
AILab

contains

an IntelliSense that supports
the

programmer to make an easy decision at any time of programming
.

Syntactic

analyzer


tries to

find

errors

from the source code
, not

lexical
errors (
What

does not

respect the

language

grammar
),
but
irregularities.(eg.
The use

of

undeclared

variables-

different

parameters
, etc…)
Table

variables


is

allocated

in

a

stack

where

values

are

saved
along with their names.
You can
also
assign

scalar

variables
-
one-dimensional
,
two-dimensional
, three-dimensional,
etc.
..
The software

manages to

make

instances

of

template

objects

(
default)
.
The user

can

override

certain

methods
.
The software

accepts

variables
-
Int
int
mama=
2
;
-
Real
real
mama=
2.3
;
-
String
string
mama=
”Hello World!”;
-
Object
-
TWebcam
-
TMicrophone
Lexical

analyzer
, Check the language grammar
(
If
there are
tokens
, operators,
instructions
,
reserved words
)

Budisteanu Ionut Alexandru
4
/
44
www.giga-software.com
Grup scolar Oltchim
AILab – scripting language for Artificial Intelligence
Syntactic

Tree

is

an

equivalent

of

source code

written

by
a
programmer

in

a tree
. The
tree and source

code
(
written by programmer)

are

identical
.
It

is

recursively
.
If you
search (
browse)

in

depth,

code

is

executed
.
Watch

You can

add

variables

to

Watch list
. In form Add to watch,
there is a

small

IntelliSense which

retains

all

the

variables

that you

placed

in

Watch
.

Budisteanu Ionut Alexandru
5
/
44
www.giga-software.com
Grup scolar Oltchim
AILab – scripting language for Artificial Intelligence
The programmer

can

create

3

new things
:
Form
,
source

code
,
and

a

template

for

a

about window

Plugins
– The software allows opening plugins from DLL. Currently is a simple plugin for example a calculator

integrated to environment as a DLL.
TMicrophone
– is a class
that

allows taking

samples

from

Microphone

(time
-
amplitude) and
transforms

them

into

time-
frequency.
It calculates

the DC (Down component)
and
can draw esantions (sample) in time-amplitude and

time-frequency
It contains

several

activation windows like
:
Hamming, Hann, Cosine, BlackMan, Lanczos, Gaussian, BarletHann,

Nuttall, BlackManHarris, BlackManNuttAll, and FlatTop

Property boolean
Remove
-
noise.
Allows

removal

of

noise

(
very
small

amplitudes
)
I created a

template class

for

speech

recognition
in order to be
to

be

used

easily
.
I

worked

with
Microsoft Multimedia system (mmsystem),
taking

such

samples

from

the

microphone
.
Samples

are

on
8

bits. For Fast Fourier Transformation (to transform from time-amplitude into time-frequency ) I used a a

component written by Dan Cross)

Budisteanu Ionut Alexandru
6
/
44
www.giga-software.com
Grup scolar Oltchim
AILab – scripting language for Artificial Intelligence
property boolean

RemoveDC; -
when you

get

sampled

automatically

remove

the Down component
(
sum

of all

samples

/ number

of their
).

freq

DC = (

esantions[i] )1/freq

i=0
property
TSpectrogramsContainer SpectrogramsContainer;

Budisteanu Ionut Alexandru
7
/
44
www.giga-software.com
Grup scolar Oltchim
AILab – scripting language for Artificial Intelligence
property boolean
RemoveDC
;
property boolean
ShowgbWave
;
property boolean
ShowgbDevice
;
property boolean
ShowgbWaveFormat
;
property boolean
ShowgbFFT
;
property
TSelectWindow
SelectWindow
;
property int
WindowOffset
;
property
TCalculateFFTEvent OnCalculateFFTEvent
;
property
TPrecalculateSamplesEvent OnPrecalculateSamples
;
property real
Sigma
;
o
TSpectrogramsContainer

Procedure void
AddSpectrograms
(
int
width
,

int
height
,

int
StartIndex
,

int
EndIndex
);

Procedure void
ConcatenateSpectrograms
;
-
Appropriate

spectrograms

which

nearly in time

are

concatenated

as

they are

the same

word


Procedure void
ScaleSpectrograms
(
int
Width
,

int
height
);

Procedure void
ReactualizeSpectrograms
;

Procedure int
GetNow
(
int
Index
);

Procedure void
TBitmap GetBitmap
(
int
Index
);

property int
ConcatenateOffset
;

property int
ContainerLength
;
TPrecalculateSamplesEvent
=

procedure void

(
TObject
Sender
,

int
[]
value
,

int
length
);
TCalculateFFTEvent
=

procedure

(
TObject
Sender
,

int
[][]
Spectrogram
,

int
length1
,

int
length2
,

real
[]
Sum
);
Window functions
:
To

select the window

should be

changed

SelectWindow

property
.
Hann window
Hamming window:
Cosine window
Triangular windows
Gaussian windows

Budisteanu Ionut Alexandru
8
/
44
www.giga-software.com
Grup scolar Oltchim
AILab – scripting language for Artificial Intelligence
TImage2

is

a class

that

allows

loading

and
it
contains several

functions
:
Procedure int
GetPixel
(
int
X,
int
Y
);
- Determina pe 32 de biti valoarea pixelului (x,y)It determines the value of

a pixel on 32 bites(x,y)
Procedure void
ClearImage
();
- It transforms the image into a white scale one
Procedure int
[width] GetLine
(
int
LineIndex
);
-
returns

an

array

containing the

values

of

all

32-
bit
pixels

per line
.
Procedure void
ResizeBitmap
(
imgo: TBitmap;
int
nw,
int
nh
);
Procedure int
[] CalculateHistrogram
();
Procedure void
Equalises Brighnest
(
int
Value
);
Procedure void
Monochrone
(
int
MonochroneValue
); -
image
binarization
with
threshold
Procedure void
GrayScale
(); -
which converts am image to

gray
-
scale
format
Procedure void
Draws Histogram
();
-
Will

draw the

histogram
Procedure void
Equalises Histogram
();
-
Histogram

equalization
Procedure void
Removes Noise
(
int
NoiseValue
);
->
Whether

pixel

with

position
v
(
m,
n
)
where

a

filtration with neighbors

=

Budisteanu Ionut Alexandru
9
/
44
www.giga-software.com
Grup scolar Oltchim
AILab – scripting language for Artificial Intelligence
Procedure void
Blour
();
->
Procedure int
[][]
Multiplicity of Matrices
(
int
[][]
A,
int
[][]
B
);
Procedure void
Open
();
Procedure void
Close
();
Procedure void
Brighnest
(
int
Value
);
Procedure void
Convolution
(
int
Switch,
int
Value
);
If

switch

is

equal
0: Gauss –
Gaussian

noise

removal

method
.
1: Prewitt1 -
Calculates the

image

differentiale
2: Prewitt2 -
Calculates the

image

differentiale
3: Sobel1 -
Calculates the

image

differentiale
4: Sobel2 -
Calculates the

image

differentiale
5: Laplace -
Calculates the

image

differentiale
6: Enhance -
Calculates the

image

differentiale
Some

masks

are

built

with

coefficients

for

differentiale.
Prewitt
Sobel
Matrix is:
Prewitt1
Prewitt2

Budisteanu Ionut Alexandru
10
/
44
www.giga-software.com
Grup scolar Oltchim
AILab – scripting language for Artificial Intelligence
Sobel1
Sobel2
Laplace
Enhance
Histogram

equalization

(
quality improvement)

Procedure void
CopyRect
(
int
dLeft,
int
dTop,
int
dRight,
int
dBottom; sCanvas:TCanvas;
int
sLeft,
int

sTop,
int
sRight,
int
sBottom
);
overload;
Procedure void
Set Input To Feed ForwardNN
(
Network:TFeedforwardNN
);

Budisteanu Ionut Alexandru
11
/
44
www.giga-software.com
Grup scolar Oltchim
AILab – scripting language for Artificial Intelligence
The programmer

can

concatenate

these

methods to

do what

he wants
.

For

example, to

write

an

application

that

recognizes

coins

(cells
)
in

an

image,

he will

apply
:
Binarization

(
mochronization),
will

make

labeling
(
labeling

function

will

return the

position
,
length
,
width
,

number
of

pixels
).
The programmer

writes

in the

language

aspect ratio

of

found objects

and

if

reports

are

almost

identical

there may

be

a

coin

then he will

try

to

classify them

with

a

neural network
.
TWebcam

a

class

that

allows
to takes shots from
webcam
Application allows creating minimal examples.
Instructions
I/O
It can be
used for
reading

/

writing

data

from

keyboard

/

file
·
Write

in

the console


allows to dislay data into console

To

be

used, it

must be

written
in the system.CreateConsole();
Example
string
tata=
”Hello World!”;

print
(
2,” “,2
+
5.2,
”\n”
,language,”AILAB”+
” Hi! “
);
It will display into console:
2 7.2
Hellow World!AILAB Hi!
·
Read from console – allows to read data from console
To

be

used, it

must be

written
in the system.CreateConsole();
Example:
real

my_variable =
2.3
;
scan
(my_variable,
”\n”
);
print
(my_variable);

Budisteanu Ionut Alexandru
12
/
44
www.giga-software.com
Grup scolar Oltchim
AILab – scripting language for Artificial Intelligence
After execution:
I
will enter

from

the keyboard

value
4.5
4.5
·
Write into file – allows to write data into a file
·
Read from file – allows to read data from a file
Math
Procedure string

Diff
(
string
expression
);
-
will

calculate the
differential expression from
string
Example diff(cos(x)) it will return –sin(x)
Example diff(sin(x)/(x^2)) it will return (cos(x)*(x^2)-sin(x)*2x)/x^4
Procedure int

[][]
MatrixMultiplicty
(
int

[][]
a,
int

[][] b);
- will calculate the multiplicity for A*B
System
Contains several important functions.
Procedure int
IsEmptyArray
(
int
[]
Value
);
-

He

will

check

if

all

elements

of the

array

are

0
Procedure int
[]
CalculateSumBMatrix
(
int

[][]
Value);
Procedure string
GetTimeToStr
()
; -
It will
return
the time

format to a string
Procedure void
ShowMessage
(
string
Value
);
-
Will start

a

dialog

with

the message

brought
Procedure int
GetGValue
(
int

Value
);
Procedure int

GetRValue
(
int
Value
);
Procedure int
GetBValue
(
int
Value
);
Procedure real
CalculateEnergy
(
int
[][]
Value
);
Procedure real

CalculateDispersion
(
int
[][]
Value
);
Procedure void
ProcessMessages
();
-
It

reads your

operating

system messages
.
Procedure void
ShowConsole
();
-

will

create

a

win32

console
.
If

it is

visible

(
will not
create

a

new

one
);
Procedure void
HideConsole
();
If

the console

is

visible

then it will

close.
property string
ProgramPath
()

It

returns

path

program
TFeedForwardNN

Neural

methods

can

be

applied

successfully

in

software

with

incomplete

data
,
erroneous

values

around at some values

called

clusters
.
Is a visual class which allows you to create Multi-Layer-Perceptron

Artificial Neural Network .
The networks

are

trained

with

some

representatives

of

the cluster

as

the

simulation

will

be

assigned

values

from cluster
,
the software

managed

classification
.
Again

this is

not

a

pattern
-
matching
or

Hamming

distance
,
but

a

way

to

work

with

uncertain data

Budisteanu Ionut Alexandru
13
/
44
www.giga-software.com
Grup scolar Oltchim
AILab – scripting language for Artificial Intelligence
It contains:
·
TNetwork.
·
TSave – contains methods:

Procedure void
SaveXML
(
string
Const Path
); -
save the NN in XML file

Procedure void
OpenXML
(
string
Const Path
);
- load an NN from XML file

property
TAction Action; - property that is selected

property boolean
ShowInput;

property boolean
ShowBrush;

property boolean
ShowBias;

property boolean
ShowN;

property boolean
ShowA;
TBackPropagationThread
– is used to learn an artificial neural network. You can learn with BackPropagation,

BackPropagation with moment and Barken Moody.
Evolution of

error

during the

network learning
.
Notations used
q
number of training sets
p
Q
– input, from q set
t
Q
– output(target), from q set
E


error calculated in the current step
k –
step (epoch)
m –
layer (1th layer is input, [2nd .. m-1] hidden layers, [m] output layer)


i
Bias Perceptron from
m
layer

at
k
step
- Weight perceptron
i
from
m

layer and perceptron
j
from the
m-1
layer at
k
step
- learning rate

Budisteanu Ionut Alexandru
14
/
44
www.giga-software.com
Grup scolar Oltchim
AILab – scripting language for Artificial Intelligence
- sensitivity perceptron
i
from
m

layer at current step
- value perceptron
j
from
m

layer at current step
- lay out perceptron
j
from
m

layer at current step = F(
)
-
variable learning rate, from Darken Moody algorithm
- coefficient moment from BackPropagation with momentum
Jacobian Matrix
a,b,w,F,s,n

are matrix
i,j,k
,

,
,
are numbers(scalar)
·
BackPropagation (with out momentum)
Training set
p
1
t
1
{
,
}
p
2
t
2
{
,
}


p
Q
t
Q
{
,
}
,
,
,
Mean square error
F
x
(
)
E
e
2
]
[
=
E
t
a

(
)
2
]
[
=
(I have used E=[t-a], not Mean Square Error)
Weight update
w
i
j
,
m
k
1
+
(
)
w
i
j
,
m
k
(
)

s
i
m
a
j
m
1


=
W
m
k
1
+
(
)
W
m
k
(
)

s
m
a
m
1

(
)
T

=
Bias update
b
i
m
k
1
+
(
)
b
i
m
k
(
)

s
i
m

=
b
m
k
1
+
(
)
b
m
k
(
)

s
m

=
Jacobian Matrix
Finally, back-propagation sensitivity,
For last layer

Others layers

Budisteanu Ionut Alexandru
15
/
44
www.giga-software.com
Grup scolar Oltchim
(
)
(
)
1
,
2
,
,
1
1
1



=
=
+
+
M
m
m
T
m
m
m
m
s
W
n
F
s
(
)
(
)
a
t
n
F
s


=
M
M
M

2
AILab – scripting language for Artificial Intelligence
So weight updates:
W
m
k
1
+
(
)
W
m
k
(
)

s
m
a
m
1

(
)
T

=

Bias update
b
m
k
1
+
(
)
b
m
k
(
)

s
m

=
·
BackPropagation with momentum
So weight & bias updates overload

W
m
k
(
)


W
m
k
1

(
)
1


(
)

s
m
a
m
1

(
)
T

=

b
m
k
(
)


b
m
k
1

(
)
1


(
)

s
m

=
·
Darken Moody
Derivatives used in the program are standard. I had calculated them with Matlab. So, practically, there is no

derivative calculated instantaneously.
All are defined in the code. The formulae were tested in Matlab.
TGeneticAlgorithm
is a class for genetics algorithm.
The idea

is

that the class works like a template

programmer

that has
to override

functions

such as:
Create Population
Make mutations
Elitism
Combination



cross
Selection
Choose

solution
.

Budisteanu Ionut Alexandru
16
/
44
www.giga-software.com
Grup scolar Oltchim
AILab – scripting language for Artificial Intelligence
FeedForward Neural Network examples
1.
Optical Character recognition1
I
created
an

example

to

test the

ability

of

neural

network

to classify
.
I can

draw

characters

and then

if

I

check

"
Inference
output
",
then

the software

creates

a

logical inference

to

automatically

classify the image in which

class

is
.
Of course

I

created

a

neural network
, a
training

set

(consisting

of

input

and

target)

and

learned
.
Simulation is in

real time.
Basically

you can

see that the

network can recognise other images(data

with noise)
.
The network

was

learned

once
.
.
The matrix

is

composed

of

eight

rows and

four

columns
.
In total

40

pixels
.
I

encoded

values
with

{
0,1}
. 0-white 1-black.
It

was
learned
with

matrix

numbers

from

0-9
.
It

was

learned with

BackPropagation

with

momentum
.
The network

was

learned

with
[40,30 tansig, 10 logsig] .
There are 40

entries

for

each

pixel

(
a total of

5

*

8 pixels
).
There are
10

outputs
, because I had
tried

to

classify

10

clusters
(
the numbers

0

..

9)
The network

was

lerned

for

30

secounds.
2.
Optical Character recognition2
Another

example

using

Multi
-
Layer
Perceptron
,
was
an “real”
OCR
.
It is

intended to be able to draw in

an area

of

size

128

*

128.

If

I had

an

image of
128*128=16384 pixels,
and

the

input layer

should

be

composed

of

all

pixels
.

There are

so many

pixels

and

opted

for a

scalling

image
.
Computer

information

is

almost

the same

(
redundant

information)

in both

matrix
128*128
and
in
a

matrix
of 10*10(
computer
lose very little information from the big

image into image of
10*10). From draw surface I will make a Regional of Interest (ROI) and will scale to 10*10

dimensions.

Budisteanu Ionut Alexandru
17
/
44
www.giga-software.com
Grup scolar Oltchim
AILab – scripting language for Artificial Intelligence
3.
Speech recognition
As
ANN can only classify, so I have to turn my problem into a classification problem.

Sound must be

turned into a picture. Neural network will try to classify the sounds
.
Creating a picture in amplitude-time domain

is not useful , so I need to work in the frequency domain
Then I wanted to see if a MLP neural network can classify sounds
.

When I

called

the function

of

drawing

samples
,
it

removed

the down component

(
DC)
[
Figure
3.1
].
Then

I

dropped

DC

(
down component)
and

multiplied

by

Hamming

window
, to
improve the

quality of

recorded

sound

from

microphone
.
The hamming window is
: hamming(x)=0,54-0,46*cos(2*pi*(x/256)) [
Figure 3.2]
. This function is a classicaly

one.
Algorithm with Hamming window
: I
took the first 256[1..256] samples inserted them into a buffer and

multiplied with Hamming values
–a
fter calculating the first window. Calculating Fast Fourier

Transformation
.With the results obtained I calculated the module from complex numbers , o
btaining one column

from the gray-scale image(sound spectrogram).
So I obtained 8000(number of samples taken in one second) / 30,

(where 30 is the displacement of Hamming window)
[
Figure 3.1]
.
Then I repeated the process at next interval

[30,286] and applied the same algorithm. Then [60,316], etc. ...
Values obtained in spectrogram will be normed and multiplied by 255 to transform them into values from

[0..255]
.

I applied different methods to remove noise with mediation, down component (DC), and separate

words from break areas
. I
applied various levels of separation of noise and break interval
.
I used the first and the

last component from the entire application

Budisteanu Ionut Alexandru
18
/
44
www.giga-software.com
Grup scolar Oltchim
AILab – scripting language for Artificial Intelligence

Budisteanu Ionut Alexandru
19
/
44
www.giga-software.com
Grup scolar Oltchim
AILab – scripting language for Artificial Intelligence
Figura 3.3

here are spectrograms of three words (save, load, new).
Then, I will get the training file and the neural

network will learn.
Conclusion about speech recognition:
The separation of sounds into syllables and then their classification would not lead to an improvement in speech

recognition, a
s syllables are very close to the spectrogram and I need to have stronger classification.

Admitting

that it had performed the syllable classification, it needs a strong inference to recreate the words, possibly a

decision tree
.
Spectra classification method adopted for words would be difficult to implement for a large number

of words but it is based on the distance between spectra that is very high.
Another direction of development could

be the creation of logical inferences to separate words according to their length.
4.
Thief and Face recognition
It is an example that allows face recognition based on multi-layer-perceptron networks. To do this, I have to use

TWebCam component.
The networks are learned in this software. After face recognition, the software can be used for face

classification, using cascaded neural network who allows face classification, practically identifying a human’s face

in various pictures.
Also is presented an example of eye-recognition that can be further developed to eye-tracking software.
The method can be used for the detection of other objects from the image, for example
fire areas from

satellite images
, e
xcessive heat areas in meteorology
, hurricane recognition from satellite images, recognition of

cancer with X-rays, etc. . As an example, I tried to recognize a man with a criminal mask that was entering into a

bank or pawn house. If the software recognizes a picture it will send it via sockets to a monitoring center(security

firm) where a human operator decides whether it was a correct or a false recognition..

Budisteanu Ionut Alexandru
20
/
44
www.giga-software.com
Grup scolar Oltchim
AILab – scripting language for Artificial Intelligence
Along with this software I presented some features that allow the extraction of the image content , without

which will be very difficult to achieve. Software such as: How many apples are in a photo? - are very difficult. To

realize such a software I need several stages to write the image processing algorithms like:
Basically these functions are the first step towards artificial intelligence. Extracting the content is the first

step before classifying objects with neural networks. The objects will be extracted from images, then put on the

neural classification and then I can say: In this image it is a boy and a girl, or there are 2 apples and a tomato…. A

cr;iminal with mask or a false generated by a hat simillary with a criminal mask. Basically ,this is artificial

intelligence in image processing software, extraction and interpretation of image content
In artificial intelligence, theory proved that big images contain the same amount of information as small

images. Basically, I was interested to which category an image belongs to and not how pretty or what colors does

it have. The processing occurs in gray-scale(255) and to a minimum size to which the picture could be recognized;

if it’s too small you can’t classify, if it’s too big it contains useless and redunded information that lead only to hard

operations and don’t improve performance.
Applying this cascaded method I am able to extract the information contained in the image .Basically, the

entire image that has thousands of pixels, sums up to much smaller information: 2 apples , a man with a mask ,

etc.. that can be encrypted on a few bits, the rest of thousand of bits are unuseful I am interested only of the

information content
To create the neural network I used Back-Propgation with moment. To recognize only the human faces I

had used a [870 90 2] configuration, so the input layer was formed by all image pixels(870). On the hidden layer I

used 90 perceptrons -I tested with various types but the highest results were obtained with 120 perceptrons And

the output layer formed by 2 perceptrons(first class is the human faces, second class is for rejection, because MLP

doesn’t manages to make the rejection automatically(the MLP classify the input data to most appropriate class

even if the answer is wrong). It was saved to a XML format and imported in the software took images from the

webcam and tried to find pictures belonging to the first class

Budisteanu Ionut Alexandru
21
/
44
www.giga-software.com
Grup scolar Oltchim
AILab – scripting language for Artificial Intelligence
Testing the algorithm.
From the 512*512 image taken from the webcam, it was scalled to 60*60 pixels, because for the computer,

is the same information (redundant)
Submatrix is taken on different size which scaled to [29*30] because it has to have the same dimensions

and after that it introduce on the input layer of the learned network. It applies the simulation algorithm; make the

logic inference to the output layer. It takes the max value from all outputs and verify if is bigger than a certain

value. If so, it means that the network indentified the input images and classified them into a class
Eye recognition
I used histrogram equalization to improve the contrast. The network configuration is [870 90 2].
Thief recognition
The network configuration is [870 90 3] because there are 3 classes - [human face, the mask thief, the

rejection class]. I also use back-propagation with moment to learn the network. The recognition level goes over to

70% and it can improve through various examples at learning, or concatenate appliance of the extraction methods

of images characteristics. As a processing duration, there are 2 frames/second, pieces of frames are lost (it makes

346 verification on the scaled matrix).In case the software determines more than 3frames per minut, possibly a

thief, it sends the picture to the security firms where a human operator determines the authenticity of the image.

Basically the software doubles the panic button alert to the security systems. In case of many instances of the

software, the sent picture is saved in a queue being able to insert the queue before a picture of 0.8, priority queue.

Budisteanu Ionut Alexandru
22
/
44
www.giga-software.com
Grup scolar Oltchim
AILab – scripting language for Artificial Intelligence
5.
Face classification
Another example is face classification.
As

mentioned

before,

supposing there is a

picture

sized about
1024*860 it
will
be
scaled

into a smaller image

(
because
the information

is

redundant
) and
computer

lost

very little
.

Since

there
are 39*32=1248 pixels, a
nd

arrays

of

the

hidden layer

will

be huge
,
it splits the initial matric into smaller matrices. It will obtain three submatrices

about 13*32=416 pixels,
such

arrays

have

shrunk,

so

simulate

learning

much

faster

and

require

less memory
.

Neural

network

was

learned

with
24 images (
every

three

images

of each

person
) but it can recognise others images

(images how
have

not

been

learned
) too. It use Back-Propagation with momentum -about 40 seconds. It was tested

with 80 images and learned with 24. Error rate was 0.02%

Budisteanu Ionut Alexandru
23
/
44
www.giga-software.com
Grup scolar Oltchim
AILab – scripting language for Artificial Intelligence
After the file had been created for training,
I learnt the neural network, which could
classify images with

noises
. The
most interesting fact is that the man#4 I learned with glasses, and ANN classify without glasses, and

even from a certain angle.
At the OCR I can make a heuristic algorithm or a Hamming distance, Levenshtein distance, metric distance

for input matrix between learn matrix without noise. The distance will be minimal and it will recognize.
The classification of human faces doesn’t work
. If I change the head position with one millimeter, all

pixels in the image change.
Note that the ANN MLP classification not only learned pictures but also thousands or tens of thousands of

pictures, that look like they are classified by the nearest picture.
The disadvantage is that a picture that seems very

"distant" from them, is still classified in one class. There is no practical mechanism for rejection, ANN calculate a

metric distance from classes, and throws it into the nearest class.

Budisteanu Ionut Alexandru
24
/
44
www.giga-software.com
Grup scolar Oltchim
AILab – scripting language for Artificial Intelligence
6.
Regression

mathematics

(
approximation
of

continuous functions

elementary

MLP
)
To demonstrate that an Artificial Neural Network, Multi-Layer Perceptron can approximate continue

elementary functions, I use TPloter class which draw functions
.
MLP

network

is

universal

approximators
.

They

took

some

samples

by

hand
(blue bullets)
and

tried

to

approximate

a network

with
[1 input, 5 perceptrons

logsig, 1 purline]
7.
Tic Tac Toe
Two neural networks was learned to play a Tic Tac Toe.

The first Neural Network had [3 inputs, 10 log sign

perceptrons, 1 output logsign]. The input is the

configuration from a line/colon/diagonal and the output is

the probability to put on these 3 inputs
.
For example if the

computer player is X and on a line is O O _ then the

computer will put an X to stop the player to win.

The

second Neural Network had [3 inputs, 20 logsign

perceptrons, and 3 outputs logsign], the input is the

configuration from a line/colon/diagonal and the output

will be the

next configuration for input O O _ will be O O

X

Budisteanu Ionut Alexandru
25
/
44
www.giga-software.com
Grup scolar Oltchim
AILab – scripting language for Artificial Intelligence
8.
Vocal User Interface
Software can allow to recognise some vocal commands for car equipments that don’t represent a risk

while driving, for example vocal command for radio, open/close the window, vehicle signals(left,right) heat , etc...

Many accidents are generated by human fault because the human is concetrated to nonessential things. (e.g. the

driver is careful with how to open his radio and not with his driving)
Software brings out the maturity of the Artificial Intelligence solutions reported in computing power of

current computers. Software uses Artificial Neural Network Multi-Layer-Perceptron. sound aquires data from a

microphone.I made spectral analyze in time-frequency creating a sound spectrogram. Spectrograms are processed

and classified.
In the next image, speaking on the microphone is simulated: Open right signal, open the left window, and

change the radio volume to 70%
Software can recognise the following commands: Left, Right, TurnOff, Radio, Up, Down, Next, Exit, Window.
Proving the viability of ideas, a car can also accept voice commands reducing the driver to sleep and avoiding

the accidents.
Software can recognise 4 neural network Multi-Layer-Perceptron and I created graph to be crossing.

Recognition is validated from crossing the associated graph, practically removing the wrong state. To write the

software I used the Fourier Fast Transformation to create the spectrogram. For training algorithm I used the

Back-Propagation with moment. I tried many types of Artificial Neural Network(Kohonen, Carpenten,etc.) but I


Budisteanu Ionut Alexandru
26
/
44
www.giga-software.com
Grup scolar Oltchim
AILab – scripting language for Artificial Intelligence
have not achieved the expected results.
9.
Recognition a fingerprint of spectral noise generated by a flex
This software allows to recognize the noise generated by a flex from a microphone. For example in a

ATM(bank vault, safe etc..) I know, night thieves, cut off with a flex the bank vault(ATM,safe) and run with

money. This software tries to recognize the spectral fingerprint generated by a flex and sends via sockets a

message to a center of monitoring. In function of spectral value, duration and hour, a human operator will decide if

a terrain team to check is to be sent. . Software requires an internet connection.The human operator can watch on

web cams when software signals the possibility of a noise generated by a flex. Web cam is activated only when the

spectral fingerprint is detected, to avoid agglomerations of the human operator.
Software can classify the noise generated by a flex and others noise(like voices, noise generated by cars,

etc...)
The successful rate is at 95%. I think it can be improved to 98% using others logical inferences.
Software can be set with duration after the alarm is showed to the protection firm, it can be set from 3

seconds to 30 seconds. Minimal is 3 seconds.
The server where it will be installed on the security firm, it allows to surveillance about hundreds of clients

software, it is recommended to be less of 500. For any alarm is giving trust number, and the security firm will

receive the highest trust number(there is a awaiting queue depending of trust number)

Budisteanu Ionut Alexandru
27
/
44
www.giga-software.com
Grup scolar Oltchim
AILab – scripting language for Artificial Intelligence
In the next image, I can see the image from a webcam sent to a server via socket, because the software

thinks in the room is a noise generated by a flex and a human operator will analyze the suspect images. In the

image I can see only a connection opened.
Kohonen
1.
Data clustering
I
tried

to create

a

classic

example
. I
took

some

values
(
about

20
) in a
two-dimensional

format
which were

distributed in five sets.
An
unsupervised

neural network
(kohonen) tried
to

identify

clusters
(
identify

the

values

which sets

belong
).
If,
initially, the red points were
randomly

in a
R^2
space,
then they
migrated

to the center

of gravity

of the

clusters
.

Initially, I

counted the

number of

clusters
.

Budisteanu Ionut Alexandru
28
/
44
www.giga-software.com
Grup scolar Oltchim
AILab – scripting language for Artificial Intelligence
Genetics algorithms
I personally believe that the genetic algorithm is the simplest paradigm of Artificial Intelligence because it

doesn’t make a full space searching. It also tries to copy an environmental model (the natural evolution of

chromosomes, DNA). The Genetic algorithms properly implemented can solve any kind of problem. This

paradigm will be able to find a solution but can never find the best solution for a problem.
The biggest challenge for this paradigm is that you need to change your problem into an optimization

problem. If you use the correct technique and strategy for your problem, the GA will converge to the solution

quickly and with smaller errors.
For instance, instead using the “wheel of fortune” algorithm, you can use another algorithm. Instead of using the

sampling with normal distribution, you can use a randomly distribution with selected samples or a linear one.
It

may

be

a

crossover

point,

two or

n points
.

The

mutations

may

be

more
, less
or none.
If

there are no

mutations
, there is a possibility
of

finding

local

minimum
, so it can
fail

to find

the global

minimum
.
Note

that

it can work

binary
;
numbers of

huge

combinations
can lead us to
groups

and

practical

begin

to

repeat
.

And

the

combination of

the same

population
,
reach
to
the

same

population
,
is practically a stabil part of a group
,

here comes the

mutation

factor

it

provides
,
purely

random
, or as
another strategy

to move

into

another space

search
.
Although
GA
are

very

simple
, it
may

be unuseful

in

case

of

algorithmic

problems
,
where

the

optimal

solution
are on
seven

decimal places
.

It

finds

an

optimal

solution
,
but

does not guarantee that

is the

best
, acceptable.
The advantage

is

that it reduces

the

search

space
.
Examples:
I

had

created

several

applications of

genetic

algorithms
:

1.

Classic

GA

to

seek

a

maximum

value

or

minimum

within a

set

2.

The

second

example

was

a

Pathfinder
.


3.

Evolisa
- which is most interesting, which means that from an assembly of figures opacity can generate a

target image. Note that no encoding is not binary float.
1.
Evolisa
I wanted to create a target image created from figures with opacity I can use polygons/circles(figures) with

different colors, opacity, positions,
A demonstrative movie
http://www.youtube.com/watch?v=so-rcp8U0HA
Comparative with the video algorithm, I made some simplifications such as:
1. Gray-scale color
2.
Instead

I had

used

polygons

circles
.
3. Other strategies, because it doesn’t matter so much
4. Mutation rate is different
In the video, the algorithm was playing for 121 hours. The reason for choosing 121 hours is that the function to


Budisteanu Ionut Alexandru
29
/
44
www.giga-software.com
Grup scolar Oltchim
AILab – scripting language for Artificial Intelligence
approximate the draw has more than 1000 different parameters(200 figures, 4 positional coordonates and one for

shape). The genetic algorithm will evoluate and optimize the function in a few million steps instead hundreds of

billions. The fitness function is the metric distance between the target image and the created image.
After 23 hours and 25 minutes.
Unlike

classic

genetic

algorithms
,
this

algorithm

is

very

primitive

and

does not

contain
:
Combinations

between

chromosomes
Fitness

function

is not

associated

to each

chromosome

but

the

entire

population
.
Does not

use

classical

algorithms

such as

"
Wheel of
Fortune
",
"
elitism", etc..
The population of the genetic algorithm changes over the time because of the mutations(random changes).
The fitness function is calculated by the difference between the target image and the genetic algorithm image. The

GA tries to minimize this error
.
It should be

noted

that

there is very

little

difference

between

this

and

a

purely

statistical

algorithm
A

wrong choice

of

parameters of

a

genetic

algorithm

makes it

a

probabilistic

algorithm
.
In fact

all

genetic

algorithms
,
if they

do

so many

mutations
,
are

transformed

into

probabilistic

algorithms
,
mutation

is

only

moving

to

state space

search

and

other

maximum

to

avoid

the optimization

of

I

/

local

maximum

Budisteanu Ionut Alexandru
30
/
44
www.giga-software.com
Grup scolar Oltchim
AILab – scripting language for Artificial Intelligence
Note

that the term

came

up

at this stage

is

20 hours
,
but

that

does not

mean

that

there can be no

viable

applications

of genetic

algorithms
.
2.
Path-finder
Pathfinder

is

used

in

most games
,
and

is

written
with GA.
As

a

Lee
,
search

in

width
,
exploring

all

roads
(
in

the worst case n^2
,
and

always

get

the same

solution
),
while the

GA

found

a

way to

a point

that

one

metric

at that

point

to

end

point

is

minimal
,
practical

approaches

end
.
Running

back

closer to

our

algorithm,

so

after

running

a few

times
,
algorithms

managed to get out

the way

after

a few

runs
,
finds

the way
.
Algorithm

description
:
Each

genetic information

is

encoded

on

two

bits
.
It

encodes

information

in

two

in

two

bits
:
00 – North
01 – Est
10 - South
11 - West
Chromosome

consists of

a set

formed

by 2

bites
.
If

a

chromosome

has

seven

genetic information
,
will have

14
-bit
chromosome
.
The population

of

n

chromosomes

generates
at
random

first
.

For the

fitness

function

to

simulate

the path

of each

chromosome

and

reach

a

final

position
(
if you

encounter

an

obstacle
,
then

move
).
And then

the metric

distance

is

calculated

between the

position

where to

go

(
final
position
)
and

current position
.
Se
combined

with

a

fixed

point
.
Fitness

is

recalculated
,
then

chooses

the

elitists

and

the winners
, and after

a

number of

random

mutations

is
(
a

single

bit
).

Budisteanu Ionut Alexandru
31
/
44
www.giga-software.com
Grup scolar Oltchim
AILab – scripting language for Artificial Intelligence
3.
Finding the

maximum,

minimum

of

a

function
maximum

of a

function

presented in all the

literature

of

classical

genetic

algorithms
I used function -1+ x*sin(x/10).
I

tried

to

create

a genetic algorithm
,
to

find

the maximum
of

function

with

6

decimals
.
Scope

of

definition

of

the

function

was
[-1,3].
For

this problem

has been

coded

in

binary format
.
If you

want

six

decimal places
,
is number
(1000000).
I must

find

a

power

of

2 for
2^x-1

> 10^6 and 2^x > 10^6, so ca x = 22. So
I

coded
with
-1 represent 0000000000000000000000 and

1111111111111111111111 represent 3
Generating

function

of

population
:
They

generated

random

values

in

the range

10
[-1,3].
The combination

of

chromosomes
–b
y

the

first

x

value

of the first number
,will
combine
(
concatenates
)
the

latest
digits
(length-x)
The

second

nr
.
And the

first
x
values

of

the

second
nr se
combines

(
concatenates)

the

latest

figures
digits(length-x)
10101
~
1101 -> 1010110001
01110~1001 -> 0111011001
Function

mutation
(pozstart)
occurs

at

100 combination
,
and it involves

the denial

of a

bit

of

a no

on

a

random

position

pos

+

start
.
Fitness

function

(
x)
-

returns

the value of

the X chromosome
,
after applying the

target

function
.
He

used

the position

of

the tournament -

which

returns

chromosomes
:
max

(
first,
last
), max
(
second,

penultimate
),
max

(
third,
last-2
)…etc

Budisteanu Ionut Alexandru
32
/
44
www.giga-software.com
Grup scolar Oltchim
AILab – scripting language for Artificial Intelligence
Fuzzy
techniques
The ideea is to create
a visual tool, to create very easy Fuzzy Inference Systems
Here you can see a FIS.
I created a classical
ly example to determine if a person is young, middle aged or old. So I created a Fuzzy

Inference System with 3 membership functions. Memberships are trapezoidal functions.You can see the functions

in the next image. Functions from the next pictures are created to classify the age of a person. If the person is

young, middle aged or old.
For this problem I
used 3 functions with
trapmf
.
You can see in the next picture

Budisteanu Ionut Alexandru
33
/
44
www.giga-software.com
Grup scolar Oltchim
AILab – scripting language for Artificial Intelligence
The software c
an calculate the sum of functions, can create the numeric integral of function, and then

calculate the centroid point from the function.
Rules
With this editor, you can set the rules for fuzzy inference system.

Budisteanu Ionut Alexandru
34
/
44
www.giga-software.com
Grup scolar Oltchim
AILab – scripting language for Artificial Intelligence
Personal research
The biggest disadvantage of neural network is that there isn't a deterministic algorithm
to create the neural

network directly . U
nfortunately, Kolmogorov’s theorem assures us that there is such function
, but it doesn't assure

us an algorithm to create it(I don't know a sure method to create that function).
Neural networks adapt the weight

and bias based on gradient descent algorithm or based on other methods

as a result of successive corrections

aiming to minimize error
(
difference between the target and output value of network
)
I remember that Kolmogorov's theorem tells us that in a multi-dimensional space any function can be created from

a sum of functions of lower dimensions.
Algorithm proposed by me creates a multidimensional surface associated with an image, each pixel representing a

variable
Example:
A 30 x 30 pixel image will be assigned a function of 900 variables.
If I
give a value from interval [115,124], the function will return a high value from [0.7, 1] and if I choise from

different range, it will return a small value
Similarly I apply the same algorithm for entire of picture. I create a gauss surface in 900 dimensional
If I test this surface with this image, the result will be 1, because x1=pixe1l, x2=pixe2.... x900=pixel999
The function is designed so that the value target- image
, the function will return number 1, and for similary data

centering around the value for each pixel
function return values from interval [0.7, 1]. For values far away, the

function will return number less 0.7, and the most of them had values with 10^-20

Budisteanu Ionut Alexandru
35
/
44
www.giga-software.com
Grup scolar Oltchim
AILab – scripting language for Artificial Intelligence
Function can be created directly, it does not require learning algorithms,
only a simple algorithm to create it.,

basically being a thousand times faster than the perceptron learning method
.
Classifications can be used for

thousands of classes, being able to adjust the degree of confidence of each class.
Creating complexity is O(n*m), where the n is the number of images, and m is the data(pixels) for each image
If is very big ,the disadvantage of this method is the long simulation time,

during the simulation than in a lot of

used memory
Testing algorithm is O(n*m)
where the n is number of images, and m is the data(pixels) for each image
For MLP Neural Network the complexity is:
no0 - number of perceptrons from input layer
no1 - number for perceptrons from first hidden layer...
no2 - number for perceptrons from second hidden layer..
....
noN - number for perceptrons from output layer.
O((no0*no1)+2*no1 + (no1*no2)+2*no2 + .... + ((noN-1)*noN)+2*noN)
Memory used is O(n*m + n) where the n is number of images, and m is the data(pixels) for each image
O(no0 + (no0*no1)+no1 + (no1*no2)+no2 + .... + ((noN-1)*noN)+noN + N)
The method does not learn over time, but can be seen as a mechanism because the AI can handle uncertain data.
OCR to recognize number from 0 to 9
MLP Neural Network with BackPropagation with momentum

Budisteanu Ionut Alexandru
36
/
44
www.giga-software.com
Grup scolar Oltchim
AILab – scripting language for Artificial Intelligence
I had learned with a Back Propagation with momentum
Moment = 0.3
LearningRate = 0.1
Number of Epochs = 8000
No Darken Moody
The learning data is formed from
40 inputs
10 outputs(taget)
Learned on Dual Core, 1,5 ghz,
31.253 seconds

Budisteanu Ionut Alexandru
37
/
44
www.giga-software.com
Grup scolar Oltchim
AILab – scripting language for Artificial Intelligence
With my method I "learned" also on a Dual Core 1,5 ghz
0.0134 seconds
Now you can see some tests:
(On blue window, is a MLP Neural Network, Black window is my own method)
Face classification using my own method
The initial picture was 39*32 pixels but I split the matrix in 3 submatrices of 13*32.
So the Neural Network MLP topology had 416 inputs, 80 perceptrons on hidden layer, and 8 outputs.
I learned with a Back Propagation with momentum
Moment = 0.3
LearningRate = 0.1
Number of Epochs = 8000
No Darken Moody

Budisteanu Ionut Alexandru
38
/
44
www.giga-software.com
Grup scolar Oltchim
AILab – scripting language for Artificial Intelligence
The first 3 images of each person I had learned
Learned on Dual Core, 1,5 ghz,
2:13.621 minutes. I had stopped at 1440 epoch

Budisteanu Ionut Alexandru
39
/
44
www.giga-software.com
Grup scolar Oltchim
AILab – scripting language for Artificial Intelligence
Logical programming.
I tried to implement a conector for logical programming. The syntax is very similary with Prolog. There

are some differences as syntax.
My programming language is not case sensitivy, so the

FATHER=father, and for that, to know if sentences (rule, or

predicate) contain variables or simple litearals, I introduce a new

syntax feature; for variable you need to write $ in front of it. You

can see in the next picture that.

Budisteanu Ionut Alexandru
40
/
44
www.giga-software.com
Grup scolar Oltchim
0,5% error to recognize, maybe the

topology of neural network wasn't

good.
In my own method. I didn't split

the initiall image. Also the first 3

images of each person I had

"learned".
"Learned" on Dual Core, 1,5 ghz,
0.621 seconds.
AILab – scripting language for Artificial Intelligence
At logical programming, I had implemented only the resolution algorithm. The resolution algorithm wants to set

the
values to variables from goals, to be true all of goals. The representation is like a tree.
Predicates from the belong source.
Rules from the belong source
Goals from the belong source

Budisteanu Ionut Alexandru
41
/
44
www.giga-software.com
Grup scolar Oltchim
AILab – scripting language for Artificial Intelligence
The interpretor’s algorithm is trying to make a resolution to the goals (to obtain logical inferences). It starts from

the goal vertices and after unification between goals with other predicates/rules it will obtain the goals’ logical

inference. By this recursive method it can answers to the goal questions.

Budisteanu Ionut Alexandru
42
/
44
www.giga-software.com
Grup scolar Oltchim
AILab – scripting language for Artificial Intelligence
Contact
·
Budisteanu Ionut Alexandru:
o
Email adress:


o
Website:

www.giga-software.com

Bibliography:
1.
ACM Digital Library
2.
Neural Networks - R
ăzvan Andonie
3.
Neural Networks – Applications
Catalin
-Daniel Caleanu si Virgil Tiponut.
4.
Retele neuronale - Arhitecturi si algoritmi de Stefan Holban
5.
Neural network training based on examples, Calin Enachescu
6.
Image processing and analyzing - Constantin Vertan
7.
Artificial Intelligence, Doina Zaharia, West University of Timisoara
8.
Mathworks MATLAB documentation
9.
NeurosLab documentation
www.giga-software.com
, Ionut Alexandru Budisteanu
10.
Artificial Intelligence, Dan Rotar – University of Bacau
11.
Systems based on knowledge, Doru Adrian Pãnescu, University Alexandru Ioan Cuza Iasi
12.
Artificial Intelligence, Ioan Dziţac, University Aurel Vlaicu
13.
Artificial Intelligence, Catalin Stoian, University of Craiova
14.
Knowledge database and expert systems, Nicolae Ţăndăreanu
15.
Genetic algorithms, G. Oltean, Tehnical University of Cluj Napoca
16.
Neural and evolutionarz computing, D. Zaharia, West Universitz of Timisoara
17.
Machine learning, Daniel Morariu, Lucian Blaga University, Sibiu
18.
Artificial Intelligence, University of Berekeley
19.
Introduction to Artificial Intelligence, Pallab Dasgupta, Indian Institute of Technology Kharagpur
20.
Artificial Intelligence: A Modern Approach, Stuart Russell and Peter Norvig, Berkeley University
21.
Neural Network Toolbox from Matworks MATLAB

http://www.image.ece.ntua.gr/courses_static/nn/matlab/nnet.pdf

Software developed by Budisteanu Ionut Alexandru.
Student in 10
th
grade at High school “Colegiul National “Mircea cel Batran”.

Budisteanu Ionut Alexandru
43
/
44
www.giga-software.com
Grup scolar Oltchim
AILab – scripting language for Artificial Intelligence
For further queries related to this project contact us through the Giga-Software website
at
www.giga-software.com
or you can e-mail us at:

Budisteanu Ionut Alexandru
44
/
44
www.giga-software.com
Grup scolar Oltchim
2010-2011
Ionut Alexandru Budisteanu
Grup Scolar Oltchim

www.giga-software.com


www.seewithtongue.info


Ferdinand Street no 22, Ramnicu Valcea, 240156, Valcea, Romania