scieee Science in your language
[en] (orig)

Deep Learning to Segment Crossing Points in X-rays of Old Canvases

Abstract

This document presents our research and results in the field of study of X-rays of paints. Specifically, we will present a novel method to characterize old canvases based on the estimation of density of threads in a square of one cm side. The presented method uses a Deep Learning model to segment crossing points between vertical and horizontal threads in X-ray plates of plain weaves. Then, the density of vertical and horizontal threads are calculated from the segmentation obtained with the Deep Learning model. Accordingly, throughout this document we will be talking about different aspects. Once we had described the motivation of this work in detail, we will talk about previous approaches to estimation of density of threads in which Deep Learning tools weren’t involved. Later, we will discuss about the Deep Learning model employed in full detail. The design of the architecture will be described, as well as all the variants and tools used to optimize said architecture. Likewise, all the results of the different training sessions carried out will be presented in order to select the best architectures based on different metrics. Once the most interesting models have been selected, they will be used to obtain the segmentation of the crossing points that will serve to measure the distance between threads. We will develop a series of algorithms that allow the segmented image to be binarized and, later, the count can be obtained. All these variants will be tested and compared to offer a global vision of the performance of each one. Finally, we will present an algorithm to apply everything previously developed to full paintings, so that we can obtain their density maps. A series of examples of the density maps obtained for different plates will be presented, as well as the possible matchs found between them. We will close the document with some conclusions and defining a series of future lines of research in this field.

Read accessible full text

Deep Learning to Segment Crossing Points in X-rays of Old Canvases

Author: Delgado Bejarano, Antonio
Year: 2022
Source: https://idus.us.es/bitstreams/5fff56a9-2e8d-4a3b-8fc3-0d93a183d506/download
P oyec o Fin de Ca e a
Ingenie ía de Telecomunicación
Fo ma o de Publicación de la Escuela Técnica
Supe io de Ingenie ía
Au o : F. Ja ie Payán Some
Tu o : Juan José Mu illo Fuen es
Dep. Teo ía de la Señal y Comunicaciones
Escuela Técnica Supe io de Ingenie ía
Uni e sidad de Se illa
Se illa, 2013
T abajo Fin de Más e
Ingenie ía de Telecomunicación
Deep Lea ning o Segmen C ossing Poin s
in X- ays o Old Can ases
Au o : An onio Delgado Beja ano
Tu o : Juan José Mu illo Fuen es
Dp o. Teo ía de la Señal y Comunicaciones
Escuela Técnica Supe io de Ingenie ía
Uni e sidad de Se illa
Se illa, 2022
T abajo Fin de Más e
Ingenie ía de Telecomunicación
Deep Lea ning o Segmen C ossing Poin s in
X- ays o Old Can ases
Au o :
An onio Delgado Beja ano
Tu o :
Juan José Mu illo Fuen es
Ca ed á ico de Uni e sidad
Dp o. Teo ía de la Señal y Comunicaciones
Escuela Técnica Supe io de Ingenie ía
Uni e sidad de Se illa
Se illa, 2022
T abajo Fin de Más e : Deep Lea ning o Segmen C ossing Poin s in X- ays o Old Can ases
Au o : An onio Delgado Beja ano
Tu o : Juan José Mu illo Fuen es
El ibunal nomb ado pa a juzga el abajo a iba indicado, compues o po los siguien es p o eso es:
P esiden e:
Vocal/es:
Sec e a io:
acue dan o o ga le la cali icación de:
El Sec e a io del T ibunal
Fecha:

Acknowledgemen s
Th
is documen closes my s age as Mas e ’s s uden a he ETSI o Uni e si y o Se ille. I would like o
dedica e a ew lines o show my g a i ude o e e yone who ha e helped me and ha e sha ed wi h me
his inc edible o ma i e s age.
I would pe sonally like o hank my u o Juan José o his dedica ion and in aluable help in all he asks in
which I ha e been lucky o wo k wi h him. Thank you o making me eel so com o able wo king wi h you,
o always aking in o accoun my ideas and o e e y hing I ha e lea ned om you in all he ime we ha e
been collabo a ing. Making his p ojec would no ha e been possible wi hou you help. In addi ion, I also
hank Museo Nacional del P ado o he images p o ided o make his p ojec .
I would also like o hank my amily and iends o hei company, ad ice and suppo du ing hese wo
yea s. The good and bad imes a e always be e wi h you. O cou se, I ha e o men ion my classma es. We
ha e sha ed wo di icul and s ess ul cou ses in which we ha e always helped each o he . The e a e many
memo ies o co ee imes, alks and mee ings ha I will always emembe wi h g ea a ec ion, I wish you all
he bes in he u u e.
To conclude, I would like o hank he s uden s and p o esso s who ha e ough o he new o ma o he
mas e ’s deg ee ha conce ns us. I ha e been o una e o s udy his new cu iculum, wi h eally in e es ing
and cu en subjec s.
An onio Delgado Beja ano
Se illa, 2022
I
Abs ac
Th
is documen p esen s ou esea ch and esul s in he ield o s udy o X- ays o pain s. Speci ically, we
will p esen a no el me hod o cha ac e ize old can ases based on he es ima ion o densi y o h eads
in a squa e o one cm side. The p esen ed me hod uses a Deep Lea ning model o segmen c ossing poin s
be ween e ical and ho izon al h eads in X- ay pla es o plain wea es. Then, he densi y o e ical and
ho izon al h eads a e calcula ed om he segmen a ion ob ained wi h he Deep Lea ning model.
Acco dingly, h oughou his documen we will be alking abou di e en aspec s. Once we had desc ibed
he mo i a ion o his wo k in de ail, we will alk abou p e ious app oaches o es ima ion o densi y o
h eads in which Deep Lea ning ools we en’ in ol ed. La e , we will discuss abou he Deep Lea ning
model employed in ull de ail. The design o he a chi ec u e will be desc ibed, as well as all he a ian s and
ools used o op imize said a chi ec u e. Likewise, all he esul s o he di e en aining sessions ca ied ou
will be p esen ed in o de o selec he bes a chi ec u es based on di e en me ics.
Once he mos in e es ing models ha e been selec ed, hey will be used o ob ain he segmen a ion o
he c ossing poin s ha will se e o measu e he dis ance be ween h eads. We will de elop a se ies o
algo i hms ha allow he segmen ed image o be bina ized and, la e , he coun can be ob ained. All hese
a ian s will be es ed and compa ed o o e a global ision o he pe o mance o each one.
Finally, we will p esen an algo i hm o apply e e y hing p e iously de eloped o ull pain ings, so ha we
can ob ain hei densi y maps. A se ies o examples o he densi y maps ob ained o di e en pla es will
be p esen ed, as well as he possible ma chs ound be ween hem. We will close he documen wi h some
conclusions and de ining a se ies o u u e lines o esea ch in his ield.
III

1 In oduc ion
T y o lea n some hing abou e e y hing and all abou some hing.
Thomas Huxley
In
his documen we p esen ou esea ch and esul s in he ield o s udy o pain ings using A i icial
In elligence. In pa icula , we will p esen a no el me hod o cha ac e ize old can ases based on he
es ima ion o h ead densi ies in squa e pa ches o one cm side. The me hod we will p esen uses a Deep
Lea ning model
1
o segmen c ossing poin s be ween e ical and ho izon al h eads in X- ays o plain
wea es. Then, he e ical and ho izon al h ead densi ies will be calcula ed om he segmen a ion ob ained
wi h he Deep Lea ning model. Acco dingly, h oughou his documen we will be alking abou di e en
aspec s. Once we ha e desc ibed in de ail he mo i a ion o doing his wo k and some undamen s o
he s udy o pain ings, we will alk abou p e ious app oaches o h ead densi y es ima ion in which Deep
Lea ning ools we en’ in ol ed. La e , we will discuss abou he Deep Lea ning model employed in ull
de ail. Once he c ossing poin s segmen a ion was ob ained, we will alk abou how o es ima e he h ead
densi y pe cm. Di e en app oaches will be de eloped and compa ed in o de o de e mine he me hod ha
exhibi s he bes pe o mance acco ding o a ious me ics.
The segmen a ion ob ained using Deep Lea ning and he code de eloped o es ima e he h ead densi y
allow us o ge he e ical and ho izon al h ead densi y in a single c op o one cm side. Since we a e
in e es ed in es ima ing he e ical and ho izon al h ead densi y in whole pain ings, he las pa o his
documen will desc ibe how we ha e implemen ed a solu ion o his asks making use o all me hods
p e iously desc ibed. In his way, we a e able o ob ain some g aphs in a whole pain ing based on he h ead
densi y in bo h e ical and ho izon al di ec ions. These g aphs will be named densi y maps. Finally, i
mus be aken in o accoun ha ob aining he densi y maps can ake se e al hou s when big pain ings a e
p ocessed, e en using powe ul machines. Since he p ocess o ob aining he densi y maps o whole pain ings
can become ac ually slow, an al e na i e solu ion ha e been de eloped o ake ad an age o mul ip ocessing
capabili ies. Also, he pe o mance o di e en machines ha e been s udied in o de o p o ide an o de o
magni ude o he p ocessing ime acco ding o pain ing size and he capabili ies o he machine. A summa y
o he asks pe o med in his wo k is p esen ed below:
•
Desc ibe a se ies o concep s abou ab ics, looms o can ases and he use o X- ays in he s udy o old
pain ings.
•
Re iew he scien i ic li e a u e o lea n abou he p e ious wo ks de eloped in he ield o cha ac e iza-
ion o X- ay pla es o old pain ings.
•
De elop a ious Deep Lea ning models o segmen c ossing poin s in images o one cm side. Bo h he
image da abase and he co esponding labels we e p o ided o us by he u o .
•
Compa e di e en me hods o es ima e h ead densi y om he c ossing poin segmen a ion ob ained
p e iously.
•
C ea e an algo i hm o ob ain densi y maps o whole pain ings making use o some lib a ies p o ided
by he u o .
1All he code ha e been de eloped using Py hon. Tenso Flow and Ke as lib a ies ha e been used o Deep Lea ning asks.
1
2Chap e 1. In oduc ion
•
Enhance said densi y maps algo i hm using mul ip ocessing, es ing he pe o mance in a ious cases.
•
Gene a e densi y maps om se e al pain ings and compa e he gene a ed densi y maps o di e en
pain ings o ind ma ches be ween hem.
•Men ion some u u e lines o esea ch in his a ea.
1.1 Mo i a ion
The inal goal o his wo k is gene a ing a ious g aphs pe pain ing ha allow conse a o s o s udy and
compa e di e en a wo ks. Among all o hose g aphs, we can highligh wo igu es: one o hem ep esen s
he e ical densi y map and he o he ep esen s he ho izon al densi y map. Each densi y map desc ibes
wi h a colo he numbe o h eads pe cm o each egion o one squa e cen ime e o he pain ing. The
in e es in gene a ing densi y maps o di e en pain ings o analyze and s udy hem is no new. To he bes o
ou knowledge, un il now di e en ools ha e been de eloped, highligh ing hose based on signal p ocessing
(pe o ming a equency analysis o he can as) and o he s based on machine lea ning. In sec ion 2 we will
desc ibe in de ail all he p e ious app oaches o he es ima ion o densi y maps in a wo ks. Howe e , we
ha e e i ied ha hese solu ions ha e nume ous limi a ions ha p e en us om using hose ools in di e en
scena ios o in app op ia e s anda ds o ime and ease o use. All his mo i a ed he in e es in applying ools
p o ided by Deep Lea ning o y o ob ain a no el me hod ha pe o ms he es ima ion o densi y maps
quickly and accu a ely. In he es o his sec ion we will discuss abou why densi y maps a e ele an o he
s udy o a pain ing. Fo his, we will p esen some key poin s abou he ab ic o he pain ings, he use o
X- ays in he s udy o said pain ings and wha in o ma ion can conse a o s ob ain om bo h e ical and
ho izon al densi y maps and he es o g aphs gene a ed.
1.1.1 Fab ic
The ab ic o a pain ing o e s us a lo o use ul in o ma ion o s udy ha a wo k. We can see he ab ic as a
inge p in o he pain ing, because he ab ic allows he pain ing o be cha ac e ized based on he in o ma ion
ob ained om he can as. Among all he in o ma ion ha can be ob ained om he can as o a pain ing, we
can highligh he ollowing ea u es [1]:
•The ype o ab ic: a e a, will o sa in
•The ab ic ma e ial: co on, linen...
•The weigh o he ab ic
•The numbe o h eads pe cen ime e in bo h e ical and ho izon al o ien a ion
•The pa e ns o h eads ha can be ound in he ab ic
•The de ia ions o he h eads wi h espec o he ho izon al and e ical axis
All hese ea u es allow conse a o s o ob ain a lo o ele an in o ma ion abou he pain ing. Fo example,
he analysis o he can as allow conse a o s o de e mine i he ab ic emains in ac and keeps i s o iginal
size o i , on he con a y, i has unde gone modi ica ions o some pieces a e missing. Also, he s udy o he
can as is essen ial o da ing he a wo k and i can help o de e mine i s au ho ship by compa ing i wi h
o he a wo ks wi h simila ab ics. I is he e o e ema kable he in o ma ion ha he s udy o he can as
p o ides o conse a o s when hey ha e o a ibu e hi he o anonymous a wo ks, o loca ing hem in ime
wi h mo e p ecision. Thanks o he cha ac e is ics o he can as, a pain ing can be loca ed in a speci ic place
and ime and, om he e, an a ibu ion o an au ho can be made h ough hese da a o h ough a compa ison
wi h he can as o o he pain ings. The s udy o ab ics also allows o make comple e s udies o au ho s by
knowing he ype o can as hey used o choose o hei pain ings [2].
1.1.2 Plain wea es
A can as is a ab ic made o a ce ain ma e ial ha is used as a suppo o pic o ial a wo ks. Th oughou
his o y, co on and linen ha e been he mos widely used ma e ials o c ea e can ases. Can ases has become
he mos used suppo hanks o i s esis ance o cold and humidi y and hanks o how ligh and easy o
anspo hey a e. The use o can as became popula om he Qua ocen o (al hough he e a e some ea lie
examples), since I alian pain e s had high-quali y Vene ian ab ics ha led o he change om pain ing on
boa ds o walls o pain ing on can as.
1.1 Mo i a ion 3
Linen ab ic is e y s ong and ea esis an , wi h a wide ange o ex u es. Howe e , i is expensi e and
can p esen ensioning p oblems wi h humidi y. Linen is widely used o oil pain ing. On he o he hand,
co on is mo e esis an o humidi y changes and i is less expensi e han linen. Howe e , co on abso bs
mo e pain and i is mo e di icul o pain on i .
To o m he can as, he ab ic is usually adhe ed o a wooden chassis ein o ced in he cen e , called
wood s e che . Thus, he ab ic is au enough o pain o e on i . To p e en he ibe s o he can as om
de e io a ing due o con ac wi h he oils, a p ime laye is applied be o e pain ing. This p ime laye is o med
by a se ies o chemical p oduc s (glyce in, zinc oxide...) ha o m a smoo h and clea su ace on which
o apply he oil. In ac , pain e s adi ionally applied laye s and laye s o polished lead p ime so ha he
su ace did no ha e a clo h-like appea ance. In his way, pain e s achie ed almos pho og aphic esul s [3].
Linen ab ic [4] Co on ab ic [5] Wood s e che [6]
Figu e 1.1 Types o ab ics and ame.
On he o he hand, ega ding he elabo a ion o he ab ics, we can di e en ia e mainly h ee ways o
binding he h eads: a e a, will and sa in. Ta e a ab ics a e p edominan , since hey a e p esen in a la ge
majo i y o he can ases used in a wo ks [7]. Thanks o a e a g ea s eng h and esis ance, i is also used
in he ex ile indus y and in uphols e y [8]. In addi ion, in his p ojec we ha e only wo ked wi h pain ings
made wi h a e a ab ics, so we will ocus on desc ibing his ype o ab ic al hough we ha e also men ioned
will and sa in.
The plain wea e ( a e ea) is cha ac e ized by an in e wining o he e ical h eads wi h he ho izon al
ones. To make he a e a ab ic, a se ies o pa allel h eads a e a anged on a loom om back o on . These
h eads a e igh ened be o e s a ing o wea e and a e called he wa p. The sepa a ion be ween he wa p
h eads ollows a de e minis ic pa e n ha is de e mined by hei placemen on he loom. On he o he hand,
ano he h ead is passed o hogonally o he wa p om one side o he o he . This o he h ead, which is
he h ead o wea e, is called he we . Since he we ollows a manual p ocess, we can expec a ce ain
a iabili y ha can be modeled as a Gaussian p ocess. The spacing be ween he we h eads depends on how
he wa p h eads a e ensioned. This c ossing o wa p and we h eads is wha o ms he balanced a e a
ab ic [9]. Bo h he wa p and he we a e usually pe ec ly isible, al hough he e a e wea es whe e he
h eads o one di ec ion can hide he h eads o he o he di ec ion.
Figu e 1.2 Plain wea e - Ta e a [10].
4Chap e 1. In oduc ion
When s udying a can as, bo h he ype o ex ile ibe used and he ela ionship be ween he we and he
wa p gi e us a lo o in o ma ion. Because o his, he coun o h eads pe cen ime e in bo h di ec ions
( e ical and ho izon al) is used as a undamen al cha ac e is ic in he s udy o can ases [1]. We a e in e -
es ed in knowing (and ha is he inal goal o his wo k) he numbe o e ical and ho izon al h eads pe
squa e cen ime e in each agmen o he can as o ha a ea. When making compa a i es be ween di e en
pain ings, da a on h ead densi ies can be e y use ul. Fo example, we know ha all can ases made om he
same wa p oll will ha e he same h ead densi ies in he wa p di ec ion.
Logically, coun ing h eads in squa es one cen ime e on a side is a e y complex and edious ask o do
manually. In ac , we can ace si ua ions whe e di e en people obse e a di e en h ead numbe , o ha
some h eads a e no comple e on he edges and i is no known whe he o coun ha edge h ead o no . In
addi ion, when wo king wi h old can ases we ha e o ake in o accoun he a iabili y o densi ies in a can as
as a esul o he use o e y old looms and he passage o ime.
Figu e 1.3 Pa s o an old loom [11].
As we men ioned be o e, he e a e mo e s udy pa ame e s apa om he densi y o h eads pe cen-
ime e , such as he de ia ion su e ed by he h eads wi h espec o he ho izon al and e ical axes. This
de ia ion occu s because he can as is ixed o he ame by nails, so we can s udy he de ia ion o ge
in o ma ion abou he can as. The de ia ion o he h eads and he posi ion o he nails can be use ul o con-
se a o s o s udy he in eg i y o he can as o o compa e p oduc ions be ween di e en a esanal wo kshops.
Finally, i emains o us o alk abou how o coun he h eads o he can as, since his is no a i ial
ma e . The on o he can as (whe e he image is pain ed) is co e ed wi h pain and p ime . Fo his eason,
dis inguishing he h eads is i ually impossible, e en wi h highly de ailed pho og aphs. We could ake a
pho og aph o he back o he pain ing o s udy he can as, howe e his is o en no possible because new
pieces o clo h a e usually added o he back o ein o ce he can as o e he yea s, making i impossible o
pho og aph he o iginal ab ic. Fo all hese easons, he me hodology cu en ly adop ed (and wi h which we
ha e wo ked) consis s o analyzing X- ay pla es o he pic u es [12].
1.1.3 X- ays
As we ha e men ioned, he use o X- ays o s udy he ab ics o he pain ings is undamen al, since i allows o
access o images o he h eads ha make up he can as in o de o coun hem. This is possible hanks o he
p ime ha was applied o he can as o pain o e , since as we ha e commen ed, said p ime has elemen s
such as lead ha a e opaque o X- ays, allowing he adiog aphic image o be o med. Howe e , he X- ay
pla es supe impose all he s uc u es. So, we will see in he same image he h eads, he pain , he c acks,
1.1 Mo i a ion 5
he wood s e che , he damage, he di e ences in p ime be ween a eas o he same pain ing, e c. All hese
elemen s will be ea ed as noise, since we a e only in e es ed in being able o coun h eads.
Finally, we can summa ize his chap e in a se ie o key ideas:
•
The ab ic o a pain ing gi es us a lo o use ul in o ma ion o s udy, compa e and p ese e ha pain ing.
•
The main ea u e ha we can ex ac om he ab ic o a pain ing is he h ead densi y pe squa ed cm
in bo h e ical and ho izon al di ec ions.
•X- ays pla es o pain ings a e used o be able o coun he h eads o a ab ic.
Adan y E a (Rubens, 1628) [13] X- ay pla e o Adan y E a [38]
Figu e 1.4 Pain ing and X- ay pla e o Adan y E a by Rubens.
Figu e 1.5 Ve ical densi y map o Adan y E a by Rubens.

2 S a e o a
The mo e you ead, he mo e hings you will know. The mo e you
know, he u he you will go.
D Seuss
In
his chap e we will p esen he e iew o he li e a u e ca ied ou o know and compa e he solu ions
p o ided by o he au ho s when s udying and cha ac e izing pain ings. Special a en ion will be ocused
o hose wo ks ela ed o ob aining and analyzing he h ead densi ies o he ab ic. Besides, o he wo ks
ha a e no so ela ed o he objec i e o his p ojec will be men ioned, as hey can p o ide ce ain ideas o
u u e and inno a i e lines o esea ch.
Among all he solu ions ha we will men ion, we will highligh hose based on equency s udies, obus
bu wi h some limi a ions, as well as new app oaches h ough Machine Lea ning and Deep Lea ning, since
ou wo k is based on he design and use o a Deep Lea ning a chi ec u e o ob ain he densi y maps o he
pain ings.
2.1 Fab ic equency analysis
In he p e ious chap e we ha e alked abou he ele ance o s udying he can as when i comes o es o ing,
analyzing, o p ese ing he pain ings. In his con ex , he g ea amoun o in o ma ion ha h ead densi y
maps can o e us o da e and compa e a wo ks has become clea . In he li e a u e we ind di e en wo ks
ocused on ob aining he densi y maps. In his i s sec ion we will ocus on se e al wo ks ha a e based on a
equency analysis o he ab ic, ob aining good esul s in many cases.
2.1.1 Using Fou ie T ans o m
We ind in [14] he i s wo k whe e a heo e ical amewo k is de ined in o de o model a ab ic h ough a
equency analysis based on he Fou ie T ans o m (FT). In said wo k i is commen ed ha we can know a
se ies o pa ame e s ha desc ibe a ab ic om i s Fou ie T ans o m, ha is, om he FT o he X- ay pla e.
A ew yea s la e , D.H. Johnson (one o he leading esea che s in his ield) and o he au ho s publish wo
pape s whe e hey pu in o p ac ice he a o emen ioned heo e ical amewo k, hus applying FT o s udy
can ases. In [15], he i s o he wo wo ks ha we men ion, he way o ob aining he h ead coun ing maps
is b ie ly p esen ed hanks o he s udy o he equency spec um. This spec um is ob ained om images o
1 cm side c opped om X- ay pla es o he ab ic. Likewise, a me hod o compa e he ob ained densi y maps
and ma ch hem is p esen ed, so ha i can be concluded i wo can ases we e ob ained om he same loom,
wi h all he consequences ha his in o ma ion has when da ing o a ibu ing wo ks. In [16], published
h ee yea s la e , he p e ious wo k is ex ended p o iding much mo e in o ma ion and speci ying o a ious
ypes o ab ics, al hough he co e is he same: ob aining densi y maps om he equency spec um and he
subsequen compa ison o be able o ma ch hem.
7
8Chap e 2. S a e o a
Bea ing in mind ha we a e dealing wi h an X- ay pla e o a pain ing, he in ensi y o each pixel depends
on he chemical and s uc u al composi ion o ha a ea o he image, ha is, he amoun o pain and p ime
( hickness o he laye s), he chemical composi ion, i ha egion is o e lapping he wood s e che , i he e
a e nails nea by, e c. The au ho s also desc ibe how he ab ic can be seen hanks o he lead p ime . This
compound s ays in he gaps be ween he h eads and i is seen as a ligh g ay on he pla e, hus allowing
he s uc u e o pa e n o he ab ic o be seen (excep when he image is sa u a ed, he e you can’ see he
unde lying s uc u es like he h ead pa e n). The g ea e he amoun o pain and p ime , he mo e X- ay
ene gy is abso bed and he e o e he clea e ha egion (gap be ween h eads) appea s on he pla e. The
ollowing image shows he beha io desc ibed in a plain wea e ab ic:
Figu e 2.1 X- ay o P1114 Ribe a (MNP) [34].
The eason why he au ho s eso o equency s udies o he X- ay pla e is ha he h eads o m a epea ing
pa e n on he pla e, as can be seen in he image abo e. As explained in [16], his epe i ion pa e n can be
desc ibed as a quasi-pe iodic unc ion in bo h e ical and ho izon al dimensions. Fo all hese easons, in
he pape i is p oposed o use he disc e e FT in wo dimensions (2D-DFT) o 1 cm squa e pa ches o ob ain
he h ead coun ing maps. In addi ion, hey p opose using an o e lap o 0.5 cm be ween wo adjacen pa ches
o imp o e he esolu ion and o ge a be e appea ance o he esul ing maps. The e o e, in o de o coun
he h eads au oma ically, 2D DFT o images wi h a size o 1cm is used. [16] can be consul ed o lea n mo e
de ails o he calcula ion and he exp essions o he FT o a pa ch. Howe e , we will expose he aspec s
ela ed o he in e p e a ion o he spec um, since o ob ain he spec um we will eso o Py hon lib a ies
ha do he calcula ion au onomously. Le ’s see an example o a spec um ob ained om a 1cm cu o a pla e
o ou collec ion:
Figu e 2.2 Spec um o a 1cm pa ch om a can as.
2.1 Fab ic equency analysis 9
We can app ecia e in he p e ious image a symme y in quad an s 2 and 4, as well as in quad an s 1 and 3.
This is due o he inpu image akes eal alues ( he alue o he pixels will be in he ange 0-1 o 0-255), so he
FT will be conjuga e symme ic acco ding o he p ope ies o he ans o m [26]. Tha is why in he p e ious
ep esen a ion, whe e we see he magni ude o he spec um, wo pai s o iden ical quad an s appea . Ano he
aspec o ake in o accoun is how o ob ain he h ead coun om he ep esen a ion o he spec um. The
loca ion o he maximums ha appea on he e ical and ho izon al axes gi e us he alue o said coun , since
he peaks o he magni ude o he FT a e due o he pe iods ound in he image. In his case, hose pe iods
co espond o he equency o epe i ion o he h eads in bo h di ec ions. The maximum o he e ical axis
will gi e us he numbe o ho izon al h eads and he maximum o he ho izon al axis will gi e us he numbe
o e ical h eads pe cen ime e (because he image om which we ob ained he spec um has a side o 1cm).
This is he simples app oxima ion, whe e maxima a e loca ed on he axes hemsel es. Howe e , i may
happen ha in he image o be analyzed he h eads a e inclined, no mally due o he cusping phenomenon.
This phenomenon occu s when placing he ab ic in he wood s e che ( ixing i wi h nails) be o e applying
he p ime , which causes he h eads o mo e unde ension and he usual pa e n is dis o ed. In [16], a he
han ea ing his as a p oblem, i is p esen ed as an oppo uni y o ex ac mo e in o ma ion om he ab ic,
since he spec um allows us o ex ac he angle o inclina ion o each pa ch o he ab ic. The e o e, o ake
in o accoun he possible o a ion when sea ching o he maxima on he axes ha gi e us he h ead coun ,
i is p oposed o pe o m he sea ch in a wedge-shaped a ea. This is equi alen o pe o ming a bandpass
il e ing o he spec um, emo ing all he in o ma ion om he image ha is no ela ed o he epe i ion
pa e n o he h eads and hei inclina ion. The pain , he nails, he laws, o he wood s e che a e ea ed
as in e e ences ha a e no desi ed in he equency analysis o he quasi-pe iodic unc ions. This also
elimina es he low- equency componen s associa ed wi h he g ay ones o he image.
De ini ely, o ind bo h h ead densi ies and he angle o o a ion (i i exis s), all you ha e o do is de ine he
pa ame e s ha gi e us he wedge egion o s udy: he mino adius, he majo adius and he opening angle
ha de ine ha ci cula sec o o wedge. Each ab ic equi es a speci ic s udy egion, so hese pa ame e s
a e se h ough a use in e ace in he wo k p esen ed in [16]. A special case can happens i he e is mo e
han one maximum in one o he axes. The au ho s sol e his e en by choosing he maximum ha gi es he
closes coun o he coun o con iguous pa ches. Once he coun o each 1cm egion is ob ained, densi y
maps a e gene a ed. This maps ep esen he numbe o h eads in each egion wi h di e en colo s. As
al eady men ioned, he compa ison o hese maps is wha allows us o know i wo pain ings we e ob ained
om he same oll.
Finally, no e ha [16] also p esen s a me hod o compa ing densi y maps beyond isual appea ance,
al hough we will no desc ibe i because i is no wi hin he scope o ou wo k (we a e only in e es ed in
ob aining densi y maps). I do hink i is in e es ing o commen ha , as desc ibed in [16], i is necessa y o
know i he wa p co esponds o he e ical o ho izon al o ien a ion o he can as, since he placemen o
he ab ic on he wood s e che could ha e been done in one o ien a ion o ano he . I may be he case ha
wo ames cu om he same oll ha e densi y maps ha coincide when one o hem is o a ed 90º, p ecisely
o his eason (we will see some examples h oughou he wo k).
2.1.2 Powe Spec al Densi y
Ano he in e es ing wo k is he one p esen ed in [17], whose au ho s a e esea che s and p o esso s a
Uni e si y o Se ille and also ha e ex ensi e expe ience in his ield o s udy. In said wo k, he use o FT is
ecognized as a ool o ob ain he densi y maps o a pa ch (as we saw in p e ious wo ks). Howe e , he au ho s
desc ibe some limi a ions ound when using FT o ob ain densi y maps as well as he use ulness ha hese
maps can ha e when making compa isons be ween pain ings. Mainly, i is a gued ha he equency s udy o
ab ics based on FT does no wo k well when i is applied o pain ings whose ab ics a e damaged. In ac , i
is no uncommon o ind old pain ings in which a piece o he o iginal can as is missing o i egula i ies
ha e appea ed as a esul o he passage o ime o o he icissi udes. In addi ion, hey ind ha FT also does
no wo k well i he p ime is hicke han no mal, since i does no allow he pa e n o he h eads o be
dis inguished. In summa y, he pa e n o epe i ion o he h eads mus be abou dis inguishable o some
deg ee o he FT o o e he expec ed esul s.
16 Chap e 3. Design o a Deep Lea ning Model o Th ead Coun ing
Figu e 3.1 X- ay de ail o P001692 Rubens (MNP) [38].
On he o he hand, he o he scena io whe e FT has been ound o wo k poo ly is in some ab ics whe e
he h eads (usually in he ho izon al di ec ion) a e no well pe cei ed. Ins ead, a small nodule can simply be
seen whe e he e ical h eads c oss he ho izon al ones. This usually happens because he h eads in one
di ec ion a e qui e igh , causing ha h eads in pe pendicula di ec ion can’ be seen. In his case, since he
h eads o one o he di ec ions canno be seen clea ly, he FT is no capable o analyzing he epe i ion pa e n
in said di ec ion. This is he case ha has caused he mos p oblems so a , since he esul s ob ained wi h
A acne [18] in e ms o h ead coun we e o ally useless. This is a usual si ua ion in pain ings by Velazquez.
We p esen an example o a pa ch aken om he adiog aphic pla e o P ince Bal asa Ca los on Ho seback
by Velázquez ( e e ence P001180 in MNP) [39]:
Figu e 3.2 X- ay de ail o P001180 Velázquez (MNP) [39].
These p oblema ic cases a e he ones ha mo i a e o look o a new solu ion away om he equency
analysis used un il now. Fo his eason, we will es a Deep Lea ning al e na i e wi h a iew o imp o ing he
esul s ob ained wi h equency analysis. The segmen a ion o he c ossing poin s would allow, in p inciple,
o sol e he p oblem ound in scena ios such as hose desc ibed in Figu es 3.1 and 3.2 and i mus be use ul
o he es o he cases.

3.2 Deep Lea ning basis 17
3.2 Deep Lea ning basis
Be o e s a ing o desc ibe bo h he da ase used and he model designed, I would like o p esen some
necessa y no ions abou neu al ne wo ks, since we will e e o some speci ic aspec s h oughou he chap e .
The co e o Deep Lea ning a e a i icial neu al ne wo ks, known by hei ac onym ANN. These ne wo ks
base hei ope a ion on he same idea ha we ind in biological neu ons and hei in e connec ion. ANN
a e emendously powe ul and usable in a huge spec um o use cases: om au oma ic ansla o s ha
ollow na u al language p ocessing models o ecommenda ion sys ems o s eaming pla o ms, o example.
Since he 90s o he 20 h cen u y, ANN use has sp ead a an eno mous speed, hanks o imp o emen s in
aining algo i hms and he inc ease in compu ing powe o machines, especially hanks o he appea ance o
powe ul GPUs. Thei main p oblem is ha hey equi e huge da abases o be ained co ec ly in o de o
make accu a e p edic ions [40].
As we ha e said, he basic p ocessing uni ha o ms a neu al ne wo k is called neu on due o he biological
simile. Neu ons pe o ms a simple ope a ion: hey ecei e a se ies o inpu s and p o ide as ou pu he
weigh ed sum o hese inpu s. To de e mine wi h wha in ensi y each inpu a ec s he weigh ed sum he e a e
some pa ame e s called weigh s (
w
), which mus be adjus ed du ing aining. The e is also ano he pa ame e ,
called bias (
b
), which ep esen s a cons an alue ha is added o he p oduc o he weigh s by he inpu s
[43].
Figu e 3.3 Neu on [43].
The ou pu o he neu on,
y
, he e o e co esponds o a linea weigh ing o he inpu s. Howe e , o make
he ne wo k capable o inding complex pa e ns (which usually in ol e non-linea i ies), we will ha e o
ans o m he ou pu o he neu ons in some way so ha hey a e non-linea , since o he wise we would no
achie e any hing by g ouping many neu ons (because se e al successi e linea combina ions can be desc ibed
as a single linea combina ion). This p oblem is sol ed using he ac i a ion unc ion, which ecei es he
ou pu o a neu on as inpu and modi ies i acco ding o a speci ic non-linea i y. Among he mos ou s anding
we ind he ac i a ion unc ions ReLU, sigmoid o hype bolic angen [40]. Once he ou pu o each one o
he neu ons is non-linea ized, i is possible o chain many neu ons (o laye s o neu ons) o make he ne wo k
dis inguish e y complex pa e ns o classi y, g oup da a o p edic new alues [43]. Bias has been omi ed o
simpli y he ep esen a ion o Figu e 3.4, bu ollowing he scheme o Figu e 3.3 he e m
b
would be added
o he p oduc o he weigh s by he inpu and, subsequen ly, all ha sum would go h ough he ac i a ion
unc ion:
Figu e 3.4 Ac i a ion unc ion [43].
18 Chap e 3. Design o a Deep Lea ning Model o Th ead Coun ing
ANNs a e ne wo ks o med by many o hese neu ons. We can place many neu ons in a laye , o many
laye s wi h many neu ons o ming deep ne wo ks. I is impo an o men ion ha all neu ons in a laye a e
connec ed o all neu ons in he nex laye . Because o his, hese ne wo ks a e known as ully connec ed
o eed- o wa d ne wo ks [40]. The inpu o a neu al ne wo k will ha e as many neu ons as inpu da a
dimensions. Fo example, i he inpu is a ec o o 100 elemen s, he i s laye o he ne wo k mus ha e 100
neu ons. The numbe o ou pu neu ons will be gi en by he applica ion o which he ne wo k was buil , high-
ligh ing in his case he classi ica ion o eg ession ne wo ks. In eg ession ne wo ks he e is a single ou pu
neu on, which p o ides he alue o he eg ession. In classi ica ion ne wo ks he e a e as many ou pu neu-
ons as classes o be classi ied, ac i a ing one o he neu ons abo e he es depending on wha class he inpu is.
Figu e 3.5 Feed- o wa d Ne wo k [43].
Despi e all he bene i s discussed abou ully connec ed ANNs, hey ha e a limi a ion when wo king wi h
images. To handle images as inpu da a, images a e i s con e ed in o a one-dimensional ec o wi h as
many inpu s as he e a e pixels in he image. As we ha e commen ed, each inpu da a co esponds o a neu on
o he i s laye , so when wo king wi h images he e will be an inpu neu on o each pixel o he image.
La e , when mo e laye s wi h mo e neu ons a e added, since hey a e all connec ed o each o he , he numbe
o pa ame e s would inc ease conside ably when wo king wi h images o a ce ain size. On he o he hand,
ha ing con e ed he image in o a ec o , all he spa ial in o ma ion o he image has been los . This causes
ha we do no ha e access o many spa ial ea u es p esen in an image which can be ex ac ed om he
loca ion o each pixel. Fo example, he ela ionship o each pixel wi h i s neighbo s o he s uc u es ha
g oups o pixels de ines can gi e us a lo o use ul in o ma ion [44].
Fo all his, con olu ional neu al ne wo ks (CNN) we e de eloped and a e he ones used when wo king
wi h images. Consequen ly, he ype o ne wo k ha we a e going o design o ou p oblem will be a CNN.
This ype o ne wo ks ede ines he app oach o be able o ex ac spa ial ea u es om images, one o he
limi a ions o ully connec ed ANNs. Now, he hidden laye s a e no o med by neu ons as we saw be o e,
bu by con olu ional il e s (also called ke nels) [40]. These il e s a e con ol ed o e an a ay o pixels
and hey a e shi ed ac oss he image so ha all pixels in he image ha e con ol ed wi h he il e s. By
con ol ing he ke nels wi h he g oup o pixels, some ea u es om ha g oup o pixels a e ex ac ed (lines,
shapes...). So, when passing he image h ough he il e we ha e a map o he image’s ea u es (one map
o each il e ). Each inpu o hese ke nels akes a alue ha weigh s he con olu ion. These weigh s will
be ained in he CNNs (analogous o he pa ame e s o he neu ons in ully connec ed ANNs). As in ully
connec ed ANNs, he esul o he ke nel con olu ion is passed h ough an ac i a ion unc ion, he ReLU
unc ion being he mos ypical in CNNs. In addi ion o con olu ion, CNNs ha e ano he dis inc i e elemen :
subsampling [40]. Only a ac ion o all he ea u es collec ed by he il e s will be p ese ed ( hose ha
con ain he mos ele an in o ma ion). To choose he cha ac e is ics, a selec ion c i e ion is aken: no mally
he maximum o a g oup o cha ac e is ics is he c i e ion ha is usually used, al hough he e a e o he s such
as he a e age alue o ha g oup o cha ac e is ics. Subsampling allows o educe he size o ea u e maps,
which means ha he numbe o ne wo k pa ame e s does no g ow exponen ially ou o con ol as i does
when using ully connec ed ANNs o images. This p ocess o con olu ion, ac i a ion and subsampling is
epea ed in all he laye s, managing o ans o m an image in o a ea u e ec o wi h dimensions ha depend
on he design o he a chi ec u e. This ec o does con ain spa ial in o ma ion o he image, encoding said
in o ma ion in ewe en ies. In addi ion, CNNs laye s ha e a e y well de ined hie a chy: he i s laye s a e
3.2 Deep Lea ning basis 19
in cha ge o looking o simple spa ial in o ma ion: s aigh lines, cu es, simple shapes... while he deepe
laye s de ec much mo e complex shapes o pa e ns ha a e based on he cha ac e is ics o he i s laye s.
The e o e, he deepe a CNN is, i will be able o de ec , a p io i, mo e complex pa e ns o in o ma ion wi hin
he image. Once ea u es ha e been ex ac ed om an image, hey can se e as inpu o a ully connec ed
ANN o eg ession o classi ica ion. This s uc u e o CNN o ex ac ea u es + eed- o wa d ne wo k o
classi ica ion o eg ession is e y common [43].
Figu e 3.6 CNN + Fully-connec ed ANN [43].
Figu e 3.7 Subsampling 2x2 (MaxPool) in CNN [43].
Apa om he ypes o ne wo ks men ioned, some mo e complex a chi ec u es can be ound, such as
ecu en neu al ne wo ks (RNN) [50] o ans o me s and a en ion mechanisms [51], al hough we will no
desc ibe hem because hey a e beyond he scope o his documen .
I emains o us o men ion how is he lea ning o a neu al ne wo k. We a e wo king in he supe ised
lea ning pa adigm, ha is, we ha e he labels (o g ound u h) o he da a ha we use o ain he ne wo k.
The e o e, ne wo k ou pu du ing aining is compa ed wi h said e e ence u h. This compa ison se es
o measu e he e o be ween he expec ed ou pu and ha p o ided by he ne wo k. This e o is called
cos unc ion o loss uncion, and he e a e se e al ypes depending on he ask ha we wan he ne wo k o
pe o m: minimum squa ed e o (MSE), Kullback-Leible KL di e gence, Bina y-C ossen opy, e c [40].
The alue o cos unc ion will depend on he ou pu alue o he ne wo k, which depends on he alue ha
he pa ame e s o he di e en neu ons ha e aken. The e o e, once he e o has been calcula ed o ce ain
alues o he pa ame e s, we a e in e es ed in knowing how o change hese pa ame e s so ha he e o
dec eases. This is known as he g adien descen me hod [40].
The cos unc ion will usually be a unc ion ha is nei he conca e no con ex, so a p io i i will no ha e
a global minimum bu he e will be some local minima. The s a egy consis s o calcula ing he pa ial
de i a i e o he cos unc ion wi h espec o each o he pa ame e s, hus ob aining he g adien ec o o
said unc ion. The g adien gi es us he di ec ion o maximum g ow h o said unc ion, so we will mo e in
he opposi e di ec ion o he g adien o go in he di ec ion o maximum dec ease. Thus, he alue o he
cos unc ion dec eases and, he e o e, he e o be ween he ou pu o he ne wo k and he g ound u h also
dec eases. Ini ially, he ne wo k pa ame e s ake andom alues (unless hey a e explici ly ini ialized o a
ce ain alue). The cos unc ion can be ep esen ed as a mul idimensional su ace (as many dimensions as
he e a e pa ame e s in he ne wo k), so ha by a ying he alue o he pa ame e s we mo e along said e o
20 Chap e 3. Design o a Deep Lea ning Model o Th ead Coun ing
su ace. The g adien makes us mo e locally along said su ace looking o a eas whe e he unc ion ( he
e o ) is smalle . In he ollowing igu e we can see a ep esen a ion o how g adien descen wo ks: he
su ace ep esen s he cos unc ion and he black a ow indica es he zone o maximum descen (gi en by
he opposi e di ec ion o he g adien ). As we mo e o a lowe a ea o he su ace, he pa ame e s
θ1
and
θ2
(on he axes ha o m he plane unde he su ace) upda e hei alue [43].
Figu e 3.8 Pe o mance o g adien descen on a su ace ep esen ing he e o [43].
Once he g adien is calcula ed, he new alues o he pa ame e s,
ˆw
, a e ob ained by sub ac ing he alue
o he calcula ed g adien om he p e ious alue o he pa ame e s, w. This new se o ne wo k pa ame e s
will cause he ne wo k ou pu o be di e en , he e o e he alue o he cos unc ion will be di e en . This
p ocess is i e a i e and i is epea ed un il we ha e eached a local minimum. This p ocess is also in luenced
by he lea ning a e [40],
η
, a hype pa ame e o he ne wo k. The lea ning a e weigh s how much he
g adien a ec s he upda e o he pa ame e s in each i e a ion, ha is, how much p og ess is made in each
s ep.
ˆw=w−η·∇ (3.1)
η
is a e y impo an and in luen ial hype pa ame e in he aining o a model, since i he lea ning a e is
e y high he lea ning will be p ac ically andom, jumping om one a ea o he su ace o ano he wi hou
con e ging. On he o he hand, i he lea ning a e is e y low, i is possible o ge s uck in local minima
o li le ele ance. This g adien descen me hod has many mo e complex and sophis ica ed a ian s ha
op imize he algo i hm. The mos used a e s ochas ic g adien descen (SGD), Adam, Adag ad o RMSP op
[40]. In ou wo k we ha e chosen he Adam op imize , since i ends o be o as con e gence, compu a ionally
e icien and wi h li le memo y consump ion, usable o ne wo ks wi h many pa ame e s o inpu da a. In
addi ion, Adam is ca aloged as he bes op imize o p ac ically all cases in [45].
I only emains o men ion how o calcula e hose pa ial de i a i es wi h espec o each pa ame e o
he ne wo k, necessa y o build he g adien . I is no a iable op ion o do i by b u e o ce, ha is, by
calcula ing each and e e y one o said pa ial de i a i es, since a ne wo k has many neu ons, each neu on
se e al pa ame e s and many possible pa hs ( emembe ha all neu ons a e connec ed o all neu ons o
he nex laye ). Ins ead o calcula ing all his, he backp opaga ion algo i hm [43] is used. The idea o
backp opaga ion is o assign pa o he e o o each pa ame e . To analyze his dis ibu ion o esponsibili ies
in he e o , i is be e o ollow a back- o- on s a egy, ha is, om he las o he i s laye s. This allows
backp opaga ion o he e o and also allows wo king e icien ly, eusing he de i a i es al eady calcula ed
[43]. Backp opaga ion algo i hm begins by calcula ing he de i a i e o he cos unc ion wi h espec o he
pa ame e s o he neu ons in he las laye . To calcula e he de i a i e, you ha e o see he pa h ha connec s
each pa ame e (o each neu on) wi h he inal cos . In he las laye his is ela i ely simple: i s ind he
weigh ed sum ha he neu on ou pu s (
z
) and hen pass his weigh ed sum h ough he ac i a ion unc ion (
a
).
The ou pu alue o he ac i a ion unc ion o he neu ons o he las laye is p ecisely he ou pu alue o he
3.2 Deep Lea ning basis 21
ne wo k. The e o e, compa ing he alue o he ac i a ion o he neu ons o he las laye wi h he g ound
u h, he alue o he cos unc ion is ob ained. The e o e, ollowing he chain ule, he de i a i e o he cos
unc ion (C) wi h espec o he pa ame e s (w) o he neu ons o he las (L) laye can be decomposed as:
•
The de i a i e o he cos unc ion wi h espec o ac i a ion, ha is, he de i a i e o he cos unc ion
i sel (MSE o example).
•
The de i a i e o each ac i a ion unc ion wi h espec o he weigh ed sum o each neu on, ha is, he
de i a i e o he ac i a ion unc ion i sel (sigmoid, hype bolic angen ...).
•
The de i a i e o he weigh ed sum wi h espec o he inpu s ecei ed by he neu ons o he las laye ,
∂C
∂ωL=∂C
∂aL·∂aL
∂zL·∂zL
∂ωL(3.2)
In his way we ha e al eady calcula ed he pa ial de i a i es ha allow us o see how he cos unc ion
a ies wi h espec o he pa ame e s o he neu ons in he las (
L
) laye . I we p opaga e his e o o he
p e ious laye (
L−1
), he de i a i e o he cos unc ion wi h espec o all pa ame e s can be b oken down
by he chain ule in o:
•
The de i a i e o he cos unc ion wi h espec o he ac i a ion o he las laye , ha is, he de i a i e
o he cos unc ion i sel (MSE o example).
•
The de i a i e o each ac i a ion unc ion wi h espec o he weigh ed sum o each neu on in he las
laye , ha is, he de i a i e o he ac i a ion unc ion i sel (sigmoid, hype bolic angen ...) o he
neu ons in he las laye .
•
The de i a i e o each ac i a ion unc ion wi h espec o he weigh ed sum o each neu on o he
penul ima e laye .
•
The de i a i e o he weigh ed sum wi h espec o he inpu ecei ed by he neu ons o he penul ima e
laye , which co esponds o he alue o he ou pu (ac i a ion) o he neu ons o he p e ious laye
(L−2).
∂C
∂ωL−1=∂C
∂aL·∂aL
∂zL·∂zL
∂aL−1·∂aL−1
∂zL−1·∂zL−1
∂ωL−1(3.3)
As we walk he ne wo k backwa ds, he numbe o pa ial de i a i es o be calcula ed g ows os ensibly.
Howe e , hanks o he backp opaga ion algo i hm, mos o hese pa ial de i a i es a e al eady calcula ed.
As we see in he equa ion o he
L−1
laye , he only new hing o be calcula ed is he second e m, ha is,
how he weigh ed sum o he
L
laye a ies as a unc ion o he ou pu o he
L−1
laye . In his way we
mo e he e o om one laye o he p e ious one, since he only laye ha has access o he cos unc ion in
i s equa ions is he las one. This is epea ed i e a i ely un il he i s o he laye s, so ha we ha e all he
pa ial de i a i es we need jus calcula ed [43]. The aining scheme o a ne wo k would he e o e be as
ollows: he da a ha en e s he ne wo k passes h ough all he neu ons, which will show a ce ain ou pu
acco ding o he alue o hei pa ame e s ( o wa d p opaga ion). A e wa ds, he ou pu o he las laye will
be compa ed wi h he g ound u h, measu ing he e o acco ding o a cos unc ion. Finally, he e o is
p opaga ed backwa ds in o de o upda e all he ne wo k pa ame e s so ha he e o be ween he ne wo k
ou pu and he g ound u h dec eases [43].

22 Chap e 3. Design o a Deep Lea ning Model o Th ead Coun ing
Figu e 3.9 T aining scheme o a ne wo k [43].
3.3 P o ided da ase
Be o e desc ibing he model, we a e going o dedica e a subsec ion o alk abou he images p o ided o ain
i . Al hough he gene a ion o he images and hei labeling o aining a e no pa o his wo k, I conside i
ele an o b ie ly commen on how he da ase wi h which we a e going o wo k is s uc u ed.
The se o images has been ex ac ed using 41 X- ay pla es om di e en pain ings p o ided by he Museo
Nacional del P ado. The pain ings ha we can ind in he da ase a e e y di e en , ep esen ing se e al
cen u ies ( om he 17 h o he 19 h), di e en au ho s and many di e en ypes o ab ics. Some o he mos
ou s anding au ho s p esen in he se o images a e Diego Velázquez, Ped o Pablo Rubens, F ancisco de
Goya, El G eco, He man an Swane el , Miguel de P e , Luis Pa e , Ba olomé Es eban Mu illo, Claudio
de Lo ena, Jean Lemai e, Nicolas Poussin, Gaspa d Dughe , Miguel Cab e a, Jan Bo h o José de Ribe a.
Nume ous pa ches we e ob ained om all hese adiog aphic pla es, o which 260 labeled pa ches we e
p o ided. All o hem we e p ep ocessed be o e labeling o imp o e hei isualiza ion. Fu he mo e, hey
all a e 300x300 pixels size and e e yone has a esolu ion o 200 pixels pe cen ime e . So, each pa ch has
physical dimensions o 1.5cm on each side. The esolu ion o each pla e was adjus ed du ing p ep ocessing,
since o iginally each adiog aph was digi ized wi h a speci ic esolu ion.
Pa ch ex ac ed om a pain ing Labeling o ha pa ch
Figu e 3.10 A pa ch and i s label.
3.3 P o ided da ase 23
Also highligh he he e ogenei y o he da ase , since we ha e images o pain ings by many di e en au ho s
and o di e en ypes o pain wea es can as. In addi ion, he h ead densi ies pe cen ime e ha we ound
in he da ase ange om 6 o 24 h eads pe cen ime e . This shows ha we a e going o wo k wi h a wide
a ie y o cases, which may be ep esen a i e o he cases ha we would ind in a s udy o all he pain ings in
a museum wi h a e a wea e (in e ms o h ead densi ies). On he o he hand, he da ase con ains pla es
ha a e be e o wo se p ese ed: some wi h a lo o noise (c acks, damage...) and o he s wi h a e y good
appea ance, in which he h eads a e easily dis inguished. Fo all hese easons, he da ase used is e y ich
in he numbe o di e en pain ings (mo e han 40), in he numbe o au ho s ep esen ed, in he quali y o
he images and in he ange o h ead densi ies.
Figu e 3.11 Example o he a ie y p esen in he da ase .
3.3.1 Wo king wi h he da ase
Once he p o ided da ase was desc ibed, i was necessa y o adap some aspec s o be able o use he
da ase in he aining o he Deep Lea ning model ha we will p opose. Mo e speci ically, he e a e wo
common asks in Deep Lea ning ha a e usually made o ain a model: he i s is sepa a ing he a ailable
da ase , so ha some images a e used o ain and alida e he model and o he s o check how well i wo ks
making p edic ions wi h o he da a unpublished o i [41]. The o he common ask is o implemen a Da a
Augmen a ion unc ion which will pe o m a se ies o ans o ma ions on he images o inc ease he numbe
o a ailable samples in o de o ob ain be e esul s [40]. Below we will desc ibe in mo e de ail how we
ha e deal wi h hese wo aspec s.
Sepa a ion o he da a se in o subse s
In Deep Lea ning, i is common o wo k wi h di e en subse s when aining and e alua ing he pe o mance
o a model. The mos common s a egy is o di ide he da ase in o h ee subse s: a aining subse , a
alida ion subse , and a es subse . The usual ecommenda ions ha a e usually ollowed a gue ha i is bes
o alloca e 70% o he da a o aining, 20% o he da a o alida ion and 10% o he da a o es ing [40].
Howe e , hese p opo ions a e only indica i e and may a y om case o case o he p og amme ’s liking.
Ac ually, i is no e en manda o y o ha e all h ee se s, al hough i is ecommended.
Going a li le deepe , he aining se ( he la ges ) con ains he da a ha he model will use o ix he pa ame-
e s o he neu ons. This e o is no ep esen a i e o he pe o mance o he model, since he pa ame e s ha e
been adjus ed o ha e a low e o o hese speci ic da a, so he e o in aining has a bias ha means ha he
e o in eal si ua ions is unde es ima ed. [41]. In ac , i he model is badly chosen o i he model is ained
o oo many i e a ions, he aining e o can end o ze o, since du ing lea ning he ne wo k can o e i i s
pa ame e s o ha speci ic da a se ob aining an e o ha is p ac ically non-exis en . This happens because
he ne wo k has enough pa ame e s (deg ees o eedom) o ix hem so ha he aining e o is e y close
o ze o, bu his does no mean ha he model wo ks well, since he model will no be able o gene alize o
o he da a o which i has no been ained. This beha io is called o e i ing, and i is some hing o a oid [47].
24 Chap e 3. Design o a Deep Lea ning Model o Th ead Coun ing
On he o he hand, he alida ion se is used o adjus he hype pa ame e s o he model, such as he lea ning
a e, he op imize , he numbe o epochs o he ba ch size. Bo h he lea ning a e,
η
, and he op imize
ha e al eady been desc ibed p e iously. Fo i s pa , he ba ch size indica es how many aining samples
en e he ne wo k simul aneously [40]. No mally no all he aining da a is passed a once, as his would
be compu a ionally e y expensi e. Ins ead, g oups o da a a e passed consecu i ely, so ha o each g oup
o wa d p opaga ion is pe o med, he e o is calcula ed and backp opaga ion is pe o med o upda e he
pa ame e s [46]. The numbe o epochs indica es how many imes all he da a will pass h ough he ne wo k.
The alida ion da a has no been used o aining, so he model is impa ial in p o iding an ou pu when i
ecei es his da a as inpu . Howe e , he e o in alida ion is also unde es ima ed, since he hype pa ame e s
o he model ha e been chosen based on hese alida ion da a [41].
The es se is used o ob ain a ep esen a i e e o o he model’s pe o mance. Tes da a is only used o
see how he model pe o ms wi h ou -o -sample da a, ha is, da a ha is comple ely new and ha he model
has no seen be o e. The e o e, he es e o is unbiased and desc ibes how he model will beha e in a eal
p oduc ion si ua ion.
In he case o ou wo k, he di ision o he da a in o he h ee subse s has no been i ial. Due o he g ea
he e ogenei y o ou da a, i was necessa y o dis ibu e he images ca e ully in he h ee se s, so ha in all he
se s we ind he di e en densi ies o h eads pe cen ime e well ep esen ed, as well as images wi h be e o
wo se quali y. Also, since we ha e mul iple labeled pa ches om each pain ing, ca e has been aken ha all
pa ches om each pain ing a e in he same se . This a oids he case ha he e a e pa ches om he same
pain ing in he es se and in he aining se , since i his happens we would no be being en i ely igo ous
when e alua ing he pe o mance o he ne wo k.
Da a augmen a ion
We ha e also implemen ed a Da a Augmen a ion unc ion o inc ease he numbe o a ailable samples. To
ge mo e samples, he a ailable images a e a i icially modi ied, gene a ing a ian s o each aining and
alida ion image in his case. These modi ica ions mus be ealis ic, no andom, since he idea is o ep oduce
a ia ions ha can appea as eal ci cums ances. The mos ypical a e o a ions, displacemen s, o ien a ion
changes, ligh ing modi ica ions, e ical o ho izon al lips, e c. In his way, many mo e can be d awn om
each sample, conside ably inc easing he size o he da ase . We ha e implemen ed a Da a Augmen a ion
unc ion wi h which we ob ain he ollowing samples:
•
Since he images ha e a size o 300x300 pixels and a esolu ion o 200 pixels pe cm, ou pa ches
will be aken om he ou co ne s wi h a size o 200x200 pixels, each o hese pa ches ep esen ing a
piece o ab ic wi h a side o 1cm ( o ha esolu ion). This gene a es 4 samples o each image.
O iginal 300x300 pixel image Ge ing he 4 co ne 200x200 pixel pa ches
Figu e 3.12 Ob aining 4 pa ches om he co ne s o he o iginal image.
•
The o iginal 300x300 pixel image is lipped om igh o le , hen ob aining he ou 200x200 pixel
pa ches om each co ne . This gene a es ano he ou samples.
3.3 P o ided da ase 25
Figu e 3.13 300x300 pixel image lipped om igh o le .
•
The o iginal 300x300 pixel image is lipped op o bo om, hen ob aining he ou 200x200 pixel
pa ches in each co ne . This again gene a es ou new samples.
Figu e 3.14 300x300 pixel image lipped op o bo om.
•
F om each o he h ee 300x300 pixel images ( he o iginal, he one lipped om igh o le and he
one lipped om op o bo om) wo cen e ed pa ches o size 200x200 pixels a e ex ac ed. The i s
one co e s he egion de ined by he pixels [50:250, 50:250] and he second co e s he egion de ined
by he pixels [65:265, 65:265]. These pa ches ( wo pe image) a e andomly o a ed be ween 2ºand 7º
wi h espec o he e ical, in bo h di ec ions. The e o e, in o al we add 12 new samples ob ained
om o a ing hese cen al pa ches ( ou o each o he 300x300 pixel images).
•
Addi ionally, he pa ches in he egion [50:250, 50:250] a e also o a ed wi h a andom angle be ween
8ºand 12º, in bo h di ec ions wi h espec o he e ical. Hal he images a e ob ained han in he
p e ious case because in his case a mo e agg essi e o a ion is applied. We wan his agg esssi e
o a ion o be less ep esen ed in he da ase . By his way 6 new samples a e gene a ed ( wo o each
300x300 pixel image)
32 Chap e 3. Design o a Deep Lea ning Model o Th ead Coun ing
Gene a i e Ad e sa ial Ne wo ks (GANs) a e also men ioned [61]. This ype o ne wo k consis s o wo
pa s: a gene a ing ne wo k and a disc imina ing ne wo k. B oadly speaking, he gene a ing ne wo k p o ides
samples simila o he eal ones, wi h he disc imina ing ne wo k being esponsible o classi ying each
gene a ed sample as ue o alse. GANs can be use ul in segmen a ion asks in o de o inc ease he numbe
o samples a ailable o ain a segmen a ion ne wo k. Fo example, a GAN can be used o gene a e new
syn hesized images and hei segmen a ion masks.
Also commen on he exis ence o o he echniques such as:
•
Models using dila ed con olu ions [59]. These con olu ions a e ob ained by lea ing gaps o inc ease
he ecep i e ield o he con olu ion. In his way, la ge a eas a e co e ed wi hou inc easing he
numbe o ne wo k pa ame e s.
•
Regional CNNs (R-CNN) [60], which use a egion p oposal ne wo k (RPN) ha p o ides he es ima ed
bounding boxes o he candida e objec s o be segmen ed.
•
Cu en models based on a en ion [51]. Highligh he Vision T ans o me s [58], emendously powe ul
bu ha need huge amoun s o images o be ained.
3.4.2 De elopmen o an a chi ec u e o segmen a ion om sc a ch
Among all he a chi ec u es and op ions desc ibed abo e, we decided o de elop ou own e sion o a U-Ne
o he segmen a ion o he c ossing poin s. This a chi ec u e usually wo ks well wi h da ase s ha a e no
oo la ge (as long as hey a e accompanied by good Da a Augmen a ion). In addi ion, he e is a lo o code
a ailable on he in e ne ha makes i easy o de elop ou own e sion o he U-Ne wi h he Ke as and
Tenso Flow. Speci ically, we use he code in [62] as a s a ing poin . Highligh om said code he de ini ion
o he unc ion con 2dblock. This unc ion de ines wo consecu i e con olu ional laye s, so ha he ou pu o
he i s laye is he inpu o he o he con olu ional laye . Bo h he numbe o channels o il e s and he size
o he ke nel can be passed as pa ame e s. In addi ion, i o e s he possibili y o applying ba ch no maliza ion
a e bo h con olu ions. The ba ch no maliza ion me hod [40] is an ex a laye ha se es o s anda dize he
da a a e passing h ough a laye o se ies o laye s, making he aining much mo e s able and educing he
numbe o epochs needed. The a chi ec u e ollows he pa e n we desc ibed o he U-Ne in he p e ious
sec ion: con 2dblock + MaxPooling2D on he con ac ing pa h and Con 2DT anspose [63], conca ena ions,
and con 2dblock on he expansi e pa h. In addi ion, a e each Pooling ope a ion (MaxPool2D) and each
o e sampling ope a ion (Con 2DT anspose) a D opou laye can be applied. D opou laye s [64] ac as egu-
la ize s o a oid o e i ing. The idea is o deac i a e a se ies o neu ons andomly, hus p e en ing he ne wo k
om o e i ing. This way o making he aining noisie is compa able o aining di e en a chi ec u es
in pa allel. The pe cen age o neu ons ha a e deac i a ed is a hype pa ame e o he ne wo k ha has o be se .
Wi h all his we can now de ine ou own U-Ne a chi ec u e. We s a by de ining a i e laye s U-Ne . All
con olu ions use ke nels o size 3x3 and a e o ype "same" [65], ha is, a ce ain padding is applied when
doing he con olu ion so ha he ou pu is he same size as he inpu . The numbe o il e s in he i s laye is
passed as a pa ame e when ins an ia ing he model and he numbe o il e s is mul iplied by wo om laye
o laye as we go down he ne wo k. Fi s , we se he numbe o il e s in he i s laye o 16, doubling in
subsequen laye s. The D opou alue on each laye will be 0.2 ini ially. All laye s use he ReLU ac i a ion
unc ion excep he las laye . The ac i a ion unc ion chosen o he las laye was a sigmoid, so ha each
segmen a ion pixel akes a alue be ween 0 and 1. As inpu we will ha e enso s o size (N,200,200,1), whe e
N is he numbe o images ha pass h ough he ne wo k simul aneously (ba ch size).
Figu e 3.23 Ac i a ion unc ions used [66].

3.4 C ea ing a neu al ne wo k 33
Figu e 3.24 con 2dblock [62].
In he ollowing diag am we can see he a chi ec u e o he ne wo k and how he size o he ea u e maps
a ies om inpu o ou pu . No e ha in o de o conca ena e in he i s laye o he expansi e pa h, ze o
padding had o be done o go om size 24x24 o 25x25 a he i s s ep in he expansi e pa h:
Figu e 3.25
A chi ec u e used wi h
con 2dblocks
modules in blue ho izon al a ows, wi h he numbe o il e s
used,
ni
, indica ed on op. Up and down s eps in ol e hal ing educ ions o sizes downwa ds,
and duplica e hem upwa ds, wi h ze o padding i needed. Upcoming ea u es a e conca ena ed
wi h he ea u es a he same le el in he encode . The size o all ea u e maps is indica ed below
hem. A he ou pu a 1×1con olu ional il e wi h sigmoid unc ion is used.
U-Ne aining
Fo he a chi ec u e aining we will ollow hese guidelines:
•
5 di e en ains will be made. Each o hem will ha e wo andom cha ac e is ics ha will cause some
a iabili y be ween hem: andom ini ializa ion o he ne wo k weigh s and andom choice (wi hin he
ixed anges) o he angles used o he Da a Augmen a ion o a ions.
•
Two Ke as callbacks will be used: Model Checkpoin and Ea ly S opping [67]. Callbacks allow o
pe o m ac ions du ing ne wo k aining. The i s one will be con igu ed o sa e he weigh s wi h
lowes alida ion loss. The second one will be con igu ed o s op aining i he alida ion loss ha e
no imp o ed in he las 5 epochs.
•
We will use Adam as he op imize , a lea ning a e o 1e-3, a ba ch size o 32, and a maximum numbe
o 100 epochs. The shu le op ion will be ac i a ed so ha he images a e shu led when aining. In
his way, each ba ch ha passes h ough he ne wo k will con ain images om di e en pla es. This
also helps o p e en o e i ing.
•
Fo he aining we will use he bina y c oss-en opy unc ion as loss unc ion [68] and he accu acy as
me ic o e alua e he model [70].
34 Chap e 3. Design o a Deep Lea ning Model o Th ead Coun ing
Bina y c oss-en opy unc ion is go e ned by he ollowing equa ion:
BCE =−1
N
N
∑
i=1
yi·log(p(yi))+(1−yi)·log(1−p(yi)) (3.4)
In he abo e equa ion, y ep esen s he alue o he label (1 o he c ossing poin pixels and 0 o he es ).
p(y) is he p obabili y ha a pixel is a c ossing poin . I will ake a alue be ween 0 and 1, close o one
he mo e ce ain i is ha ha pixel belongs o a c ossing poin . The deep lea ning model will p edic he
p obabili y ha each pixel is a c ossing poin and he alue o he loss unc ion is calcula ed by checking he
label. Le ’s ake he example o a pixel o which he ne wo k ou pu p edic s wi h a e y high p obabili y
ha i is a c ossing poin and aking he label o ha pixel alue 1. In ha case he loss unc ion inc eases
by alue - log(p(y)). The loga i hm o a numbe close o 1 will be a nega i e alue bu close o ze o, so
when he alue o he loga i hm changes sign, he loss unc ion will inc ease e y li le. On he o he hand,
i he p obabili y o being a c ossing poin is e y small, we will ha e ha he loga i hm o p(y) will be a
high nega i e numbe , so when he sign is changed, he loss unc ion will inc ease a lo . This beha io is
analogous o pixels in which he label akes a alue o ze o. In his way, his loss unc ion akes a high alue
o bad p edic ions and a low alue o accu a e p edic ions. This is compu ed and a e aged o all he pixels.
Figu e 3.26 C oss-en opy o log loss [69].
As o he accu acy me ic, i s o mula ion is as ollows:
Accu acy =Numbe o co ec p edic ions
To al o p edic ions (3.5)
The o al o p edic ions is he o al o he 200x200 pixels o each image. This me ic compa es he bina y
alue co esponding o he ou pu ha he ne wo k has p o ided in each pixel wi h he alue o ha pixel
in he label. This means ha i bina izes he ou pu image, since he ne wo k ou pu akes alues be ween
[0-1] and i mus be bina ized. The h eshold ha he unc ion uses in e nally is 0.5, hal he ange o pixels
alues. Wi h all he abo e, we pe o m he i s aining o he model wi h he desc ibed hype pa ame e s and
callbacks. We will call his i s model ge Une , and i has abou wo million pa ame e s. All he ainings
ha e been pe o med on an In el Xeon E5-2630 4 p ocesso wi h 40 CPU Co es and wo GPU NVIDIA
Tesla P100 16GB. We p esen below he esul s ob ained in he 5 aining sessions:
Table 3.1 ge Une aining esul s.
ge Une aining esul s
T ain Numbe Epochs T ain Loss T ain Accu acy Valid Loss Valid Accu acy Tes Loss Tes Accu acy
1 2 0.1847 0.9204 0.2184 0.9079 0.2362 0.9015
2 6 0.1655 0.9273 0.2171 0.9074 0.2317 0.9035
3 6 0.1657 0.9273 0.2050 0.9123 0.2212 0.9058
4 11 0.1552 0.9315 0.2083 0.9134 0.2247 0.9043
5 6 0.1656 0.9273 0.2144 0.9090 0.2245 0.9043
As we can see in he p e ious able, in e ms o losses (bo h in alida ion and in es ) he bes is he hi d
aining. The hi d aining is also he bes in e ms o es accu acy, al hough he bes in e ms o alida ion
accu acy is he ou h aining. The bes weigh s om each ain we e sa ed. Emphasize ha only he esul s
3.4 C ea ing a neu al ne wo k 35
o loss and accu acy in alida ion will be aken in o accoun o selec he bes model, al hough we also p esen
he es esul s o comple eness. We can see below he lea ning cu es o aining and alida ion in ainings
3 and 4:
Lea ning cu e o he hi d aining Lea ning cu e o he ou h aining
Figu e 3.27 Lea ning cu es o he wo bes aining sessions.
I can be seen how in a ew epochs he bes esul is achie ed. Howe e , he aining is noisy, oscilla ing
a ound he op imum. To ha e a mo e s able aining a lowe lea ning a e can be se , so he lea ning would be
slow and sus ained. See he esul s wi h a lea ning a e o 1e−4:
Table 3.2 ge Une aining esul s, LR 1e−4.
ge Une LR 1e−4 aining esul s
T ain Numbe Epochs T ain Loss T ain Accu acy Valid Loss Valid Accu acy Tes Loss Tes Accu acy
1 18 0.1632 0.9282 0.2099 0.9091 0.2369 0.8974
2 7 0.2181 0.9128 0.2375 0.9017 0.2564 0.8917
3 18 0.1703 0.9255 0.2232 0.9049 0.2434 0.8950
4 9 0.1799 0.9229 0.2225 0.9081 0.2319 0.9041
5 16 0.1718 0.9250 0.2187 0.9080 0.2349 0.9017
In his case, he bes aining sessions a e he i s and ou h, bo h in e ms o alida ion and es losses
and in e ms o accu acy. Howe e , we see ha he alues achie ed a e wo se han in he p e ious aining
sessions. We can also see he lea ning cu es:
Lea ning cu e o i s aining Lea ning cu e o ou h aining
Figu e 3.28 Lea ning cu es o he wo bes ainings wi h LR 1e−4.
36 Chap e 3. Design o a Deep Lea ning Model o Th ead Coun ing
As we can see, he aining sessions a e slowe and mo e s able. We hink ha be e esul s a e achie ed
in he p e ious case because he aining sessions a e noisie . P ecisely his oscilla ion a ound he op imum
causes a lowe minimum o be eached in alida ion han when pe o ming a mo e s able aining. I is also
in e es ing o see he esul s ob ained o some alida ion images because compa ing he esul s o alida ion
images can be use ul o choose he bes model. We p esen below he esul s o i e andomly chosen
alida ion images o he bes aining sessions. In he igu es p esen ed below we can see he ollowing
sequence by ows: o iginal image, segmen a ions and label:
Valida ion Images
Segmen a ion ob ained wi h T aining 3, LR 1e−3
Segmen a ion ob ained wi h T aining 4, LR 1e−3
Segmen a ion ob ained wi h T aining 1, LR 1e−4
Segmen a ion ob ained wi h T aining 4, LR 1e−4
Labels
Figu e 3.29 Segmen a ion o alida ion images: .
In he g oup o images we see ha aining 4 wi h LR
1e−3
seems o o e be e esul s han ain-
ing 3 wi h he same LR. This can be seen especially in he hi d o he images, whe e he segmen a ion
ob ained wi h he weigh s o aining 4 comple ely de ec he ho izon al h ead o he lowe pa . They
bo h also p esen p oblems in he segmen a ion o he i s image, whe e bo h ha e p oblems wi h he hick
ho izon al h ead o he lowe pa . S ill, he esul s a e gene ally good. I we also include he ainings
wi h LR
1e−4
in he compa ison, we could conclude ha aining 4 is somewha be e , especially in he
3.4 C ea ing a neu al ne wo k 37
i s and hi d image. In he i s , aining 4 be e de ec s he hick h ead o he lowe pa , adding ewe
spu ious poin s. In he hi d, i de ec s he cen al e ical h ead somewha be e . In addi ion, he di e ence
in hickness o he segmen ed poin s be ween he wo bes ainings o he model wi h LR
1e−4
is also s iking.
A his poin we mus ake in o accoun he pu pose we a e pu suing, which is none o he han measu ing
he dis ance be ween he c ossing poin s. To measu e he dis ance be ween he segmen ed poin s i would be
necessa y o bina ize he segmen ed image o ha e a bina y image and hen measu e he dis ance in some
way. Fo ou pu pose, he bes model will no be he one ha pe o ms he mos iden ical segmen a ion o
he label, bu he one ha bes loca es he c ossing poin s. As we can see, he label poin s ha e a ce ain
hickness and he loss unc ion penalizes i he segmen a ion is no iden ical, ha is, i segmen ed poin s wi h
he same hickness a e no ob ained (since he e o is measu ed o each pixel). A his poin in he p ojec ,
he alida ion loss and alida ion accu acy me ics will help us de e mine he bes models, bu la e he one
ha o e s he bes h ead coun will be aken as he bes model. In any case, he bes models in e ms o
losses and accu acy seem o be he ones ha would o e a be e coun , since hey a e he ones ha segmen
he as majo i y o poin s.
In iew o hese esul s, we decided o y ano he modi ica ion o he model. The ke nel size o he i s
and las laye s changed om 3x3 o 7x7. This change was mo i a ed by he di e ence in he size o he
h eads be ween he images in he da ase . We hink ha inc easing he size o he ke nel in he i s laye
allows he ne wo k o see a mo e global con ex in he i s ea u e ex ac ion. Once again, we pe o m ano he
ound o model aining wi h he desc ibed hype pa ame e s and callbacks, keeping he lea ning a e a
1e−3
,
which is he a e wi h which we ha e ob ained he bes esul s so a . We will call his new model ge Une 6,
and i has abou wo million wo hund ed housand pa ame e s. We p esen below he esul s ob ained in he
5 aining sessions:
Table 3.3 ge Une 6 aining esul s.
ge Une 6 aining esul s
T ain Numbe Epochs T ain Loss T ain Accu acy Valid Loss Valid Accu acy Tes Loss Tes Accu acy
1 8 0.1621 0.9286 0.2034 0.9140 0.2121 0.9099
2 7 0.1628 0.9284 0.2085 0.9095 0.2262 0.9024
3 9 0.1611 0.9291 0.2062 0.9119 0.2217 0.9035
4 12 0.1640 0.9279 0.2118 0.9120 0.2501 0.8990
5 21 0.1521 0.9328 0.2062 0.9100 0.2271 0.9003
As we can see in he able, he esul s a e simila o hose ob ained wi h he o iginal model. Al hough in
gene al e ms he esul s a e somewha be e , he a ia ion wi h espec o he p e ious case is no e y no able.
The i s aining imp o es p e ious esul s in bo h loss and accu acy (in alida ion and es espec i ely)
compa ed o he ou h aining o he ge Une model, which was he bes up o now. Le ’s look a he lea ning
cu e o he i s aining o he ge Une 6 model:
Cu a ap endizaje p ime en enamien o
Figu e 3.30 Lea ning cu e o he bes model aining ge Une 6 wi h LR 1e−3.

38 Chap e 3. Design o a Deep Lea ning Model o Th ead Coun ing
And le ’s also see he segmen a ion o he es images ha we saw ea lie wi h he i s aining o he
ge Une 6 model. The segmen a ion ob ained wi h aining 4 and LR
1e−3
o he ge Une model, which is he
bes so a , is also p esen ed in o de o be able o compa e he segmen a ions isually in a com o able way:
Valida ion Images
Segmen a ion ob ained wi h he U-Ne ge Une 6
Bes segmen a ion ob ained wi h he U-Ne ge Une
Label
Figu e 3.31 Segmen a ion o alida ion images: T aining 1 wi h LR 1e−3ge Une 6.
The e a e no se e al di e ences. In he i s image, he ge Une 6 model be e esol es he hick ho izon al
h ead a ea, besides o no adding spu ious poin s in he cen al a ea o he image as he ge Une model does.
Howe e , in he hi d image, he ge Une 6 model ails in he bo om ho izon al h ead, which is ully de ec ed
by he ge Une model. This a ea is eally complex, since e en app ecia ing he image i is no clea i he e
is a h ead he e o no . In he es o he images we can see how he ge Une 6 model ends o segmen he
c ossing poin s wi h a mo e uni o m shape and wi h a highe g ay le el, ha is, wi h less unce ain y. In sho ,
i does no seem clea ha nei he is exp essly be e han he o he , al hough bo h o e qui e accep able
esul s and good alues o he alida ion loss and alida ion accu acy me ics.
Tune some hype pa ame e s
When designing an a chi ec u e om sc a ch, i is wo h asking i he a chi ec u e designed will be op imal
o he p oblem. The e a e a se ies o hype pa ame e s ha shape he a chi ec u e and go e n he aining
ha can be modi ied: he numbe o laye s, he numbe o con olu ional il e s in each laye , he lea ning a e
o he d opou alue a e some examples. In o de o op imize hese alues, he e a e ools such as he Ke as
Tune package [71]. I s use is qui e simple and in ui i e: i only equi es de ining he sea ch anges o he
hype pa ame e s o be uned and selec ing one o he sea ch algo i hms.
To de ine he sea ch anges o he hype pa ame e s, you mus de ine a Model-building unc ion ha inhe i s
om he Hype Model class. Using he
hp
objec we can de ine he anges o he hype pa ame e s ha we
wan o une. In ou case we ha e speci ied he ollowing a ia ions:
3.4 C ea ing a neu al ne wo k 39
•D opou be ween 0 and 0.5
•
The numbe o il e s on he model laye s. The numbe o il e s in he i s laye is de ined as an e en
in ege be ween 6 and 24. Remembe ha , due o he way we ha e designed he a chi ec u e, his
numbe doubles as i goes down he ne wo k.
•Lea ning a e alue o 1e−3o 1e−4.
•Apply o no ba ch no maliza ion in all laye s.
•
The ke nel size o he i s and second laye s (and hei co esponding in he expansi e pa h). Bo h
ke nels can ake alues o 3x3, 5x5 and 7x7 (each independen ly).
•
The numbe o laye s in he model. Th ee possibili ies a e con empla ed: do no add any, add one mo e
laye o add wo mo e laye s wi h espec o he ge Une model. I a laye is added on he con ac ing
pa h, i s co esponding laye is added on he expansi e pa h o main ain he U-shape o he a chi ec u e.
Once he anges o he hype pa ame e s ha e been de ined, he sea ch algo i hm mus be ini ialized. These
algo i hms p o ide an e icien way o es di e en combina ions o all he hype pa ame e s ha we wan o
une. Logically, es ing all possible combina ions (g id sea ch) would be so compu a ionally expensi e, and
would also in ol e an eno mous amoun o ime. Ke as Tune o e s h ee sea ch algo i hms [72]:
•Random sea ch, which es s di e en combina ions o hype pa ame e s in a o ally andom way.
•
BayesianOp imiza ion, which s a s by choosing he combina ions andomly bu , as he sea ch com-
ple es, i chooses he nex combina ion o hype pa ame e s acco ding o he p e ious expe ience o
combining hem.
•
Hype band, which pe o ms some ini ial andom aining wi h ew epochs o de e mine he bes
candida e alues o he hype pa ame e s. This p ocess is epea ed i e a i ely o une he sea ch.
We ha e used he BayesianOp imiza ion algo i hm wi h he ollowing con igu a ion:
•The objec i e is o minimize losses in alida ion.
•
A maximum o 30 ials will be made. Each ial is a di e en combina ion o he hype pa ame e s. In
addi ion, o each ial, 3 execu ions will be ca ied ou . Tha is, he aining will be epea ed h ee
imes o each combina ion o hype pa ame e s.
•
An ea ly s opping callback is es ablished. So, in case o no imp o ing he alida ion loss in h ee
epochs, he execu ion is s opped and he nex execu ion o ha ial s a s.
Ke as Tune gene a es a .json ile o each ial. In his ile we can see he chosen combina ion o
hype pa ame e s and he alues o losses and accu acy ha i eaches, bo h in aining and in alida ion. The
a e age ime o each ial has been abou 45 minu es. Ke as Tune p o ided he ollowing esul s:
•0.5 d opou a e.
•18 il e s on he i s laye . This numbe is duplica ed on each new laye .
•1e−3Lea ning a e.
•
5x5 con olu ional il e s in he i s laye , in e media e alue be ween he models ge Une and ge Une 6.
•3x3 con olu ional il e s in he second laye , as in ge Une and ge Une 6 models.
•Apply ba ch no maliza ion on all laye s.
•Wi hou adding any new laye .
Rega ding he ge Une 6 model, we see ha he numbe o il e s inc eases om 16 o 18, he d opou
inc eases om 0.15 o 0.5 and he size o he con olu ional il e s o he i s laye changes om 7x7 o 5x5.
No e he high d opou a e sugges ed by he une , since his d opou alue implies andomly deac i a ing
50% o he neu ons du ing aining o a oid o e i ing. Wi h all hese alues we epea a new session o 5
ainings o his new model ha we will call ge Une KT:
40 Chap e 3. Design o a Deep Lea ning Model o Th ead Coun ing
Table 3.4 ge Une KT aining esul s.
ge Une KT aining esul s
T ain Numbe Epochs T ain Loss T ain Accu acy Valid Loss Valid Accu acy Tes Loss Tes Accu acy
1 11 0.1982 0.9147 0.2167 0.9071 0.2449 0.8957
2 13 0.1651 0.9267 0.2076 0.9094 0.2285 0.9006
3 14 0.1597 0.9300 0.2063 0.9128 0.2120 0.9089
4 10 0.1614 0.9288 0.2071 0.9130 0.2133 0.9068
5 9 0.1983 0.9146 0.2304 0.9017 0.2445 0.8973
The dispa i y in esul s be ween some aining sessions and o he s is s iking. This is due o he high alue
o d opou . This d opou a e causes he 50% o neu ons o be deac i a ed. Due o his, he esul ing model
some imes wo ks e y well, bu some imes i wo ks poo ly. Speci ically, we can see how ainings 1 and 5
a e no good a all, while ainings 3 and 4 o e e y good esul s. E en so, he esul s a e simila o wha we
go wi h he ge Une 6 model. As al eady discussed, i will be in he la e chap e whe e we will choose he
bes model, since we a e no so in e es ed in ha ing he bes pixel-by-pixel segmen a ion as in ha ing he bes
es ima e o h ead densi ies.
Cus om ou pu laye
We also es ed one las in e es ing a ian o he model. As we know, he las laye has a sigmoid ac i a ion
unc ion, which p o ides as ou pu he g ay le el o each pixel, ha is, a alue be ween [0-1]. We can hink
ha i said sigmoid unc ion we e na owed, he numbe o pixels ecei ing an in e media e g ay le el would
be educed, o cing he ou pu o he ne wo k o be mo e bina y. Howe e , i he sigmoid is oo much na owed
i will become a s ep unc ion ha couldn’ be used o neu al ne wo k aining, since i has a discon inui y a
0 and is he e o e no di e en iable, so he backp opaga ion algo i hm would no wo k. Sigmoid na owing
can be simula ed i he pa ame e s ha go e n he shape o he sigmoid we e wo mo e weigh s o he ne wo k,
ha is, wo pa ame e s ha he ne wo k could adjus , as s a ed in [74]. These wo pa ame e s go e n whe e
he sigmoid is cen e ed (de aul s o 0) and how s eep i is. By c ea ing his new cus om ac i a ion unc ion
(called Cus om Sigmoid, CS) we could make he lea ning a bi easie . Now, he model has eedom o shape
he las ac i a ion unc ion in he way ha ge s he bes esul s. We p esen below he esul s o adding his
modi ica ion o he model ge Une KT. This model will be called ge Une KT CS:
Table 3.5 ge Une KT CS aining esul s.
ge Une KT Cus om Sigmoid aining esul s
T ain Numbe Epochs T ain Loss T ain Accu acy Valid Loss Valid Accu acy Tes Loss Tes Accu acy
1 15 0.1601 0.9296 0.2009 0.9139 0.2199 0.9069
2 16 0.1591 0.9300 0.2071 0.9133 0.2223 0.9070
3 15 0.1596 0.9294 0.2086 0.9122 0.2272 0.9048
4 8 0.1717 0.9262 0.2059 0.9113 0.2346 0.8993
5 13 0.1627 0.9291 0.2059 0.9119 0.2169 0.9058
In gene al, he esul s a e qui e good, especially he i s and las aining. Las ly, le ’s see he segmen a ion
ob ained wi h he bes aining o he ge Une KT and ge Une KT CS models:
3.4 C ea ing a neu al ne wo k 41
Valida ion Images
Segmen a ion ob ained wi h he hi d aining o ge Une KT
Bes segmen a ion ob ained wi h he i s aining o ge Une KT CS
Figu e 3.32 Segmen a ion o alida ion images wi h ge Une KT and ge Une KT CS.
No majo di e ences a e obse ed in ei he case wi h espec o he p e ious esul s o his li le se o
i e alida ion images. Bo h seem o esol e he hick h ead in he i s image ela i ely well, as well as
he ho izon al h ead in he lowe pa o he hi d image. In sho , we ha e se e al a ian s wi h simila
pe o mances in he absence o being es ed o hei ue pu pose: he es ima ion o he h ead densi ies pe
cm. All he weigh s o all he ainings ha e been sa ed o be able o be loaded la e . So, will be able o
e alua e he pe o mance o each model when es ima ing he h ead densi ies pe cm.
O he imp o emen s es ed
Finally, b ie ly commen on a couple o echniques o imp o e model aining, al hough wi hou no ewo hy
no el ies. We es ed he lea ning a e schedule and weigh decay echniques.
The lea ning a e schedule [75] allows adjus ing he lea ning a e in each epoch, making he alue o he
lea ning a e a y h oughou he aining as desi ed. Un il now, a cons an lea ning a e had been applied in
all aining epochs. I was ied o selec a lea ning a e decay, ha is, make he lea ning a e dec ease as he
aining p og esses. In his way, we a o a quick ini ial adjus men o he weigh s and, la e , a mo e leisu ely
and s able lea ning. So, he pa ame e s o he ne wo k g adually e ine hei alue in a con olled manne .
We ied o e ain he bes model we had so a wi h he ollowing lea ning a e decay:
LRi+1=LRi
1 + decay a e ·epochi
(3.6)
Adecay a e o 1/5 was ixed, al hough we did no ge be e esul s han we had p e iously. On he
o he hand, i was ied o add he egula iza ion me hod known as weigh decay [76]. This me hod consis s
o adding he alue o he weigh s squa ed (because he weigh s can be nega i e) o he loss unc ion and
mul iplied by a cons an called
wd
ha weigh s how much he alue o he weigh s a ec s he loss unc ion.
This cons an also p e en s he model om se ing all weigh s o ze o o make he loss unc ion dec ease.
Loss =Bina y c ossen opy +wd∗(W2)(3.7)
48 Chap e 4. F om segmen a ion o h ead coun ing
I we supe impose he loca ed poin s o he o iginal image, we can see wha poin s we a e ge ing:
Figu e 4.9 Loca ion o poin s using local maxima.
The esul is qui e sa is ac o y o his p esen ed image and o o he s. F om he e on, we will conside
bo h h esholding me hods (scaled O su’s me hod and he local maxima il e -based me hod) o pe o m he
ollowing es s, so ha we can see which one o e s be e esul s o he alida ion and es se s.
4.2.2 Spa ial coun
Fi s o all, we will implemen a spa ial coun algo i hm ha allows us o measu e he dis ance in pixels
be ween a c ossing poin and he es . The e o e, he i s s ep is o loca e he neighbo hood c ossing poin s
o any c ossing poin in he image. To pe o m his ask we eso o he KDT ee decision ee algo i hm
[83]. This algo i hm is a bina y decision ee, so ha he nodes ep esen hype planes ha sepa a e da a
poin s. They a e widely used o sea ching o nea by neighbo s. Once he ee is buil aking as inpu he
ma ix con aining he coo dina es o he cen oids, he que y me hod is used o ob ain he nea es neighbo s.
In ou case we will sea ch o he 9 closes neighbo s o each cen oid. This alue is su icien o always ind
a neighbo . We ha e p og ammed ou spa ial coun ing unc ion so ha i he e a e less han 9 cen oids, an
e o excep ion is h own. F om he sea ch o he 9 nea es neighbo s we ob ain wo ma ices: he i s is he
dis ance ma ix, o size Mx9 (whe e M is he numbe o de ec ed cen oids), which con ains in each ow he
dis ance om each cen oid o each o he 9 nea es neighbou s. The second ma ix ob ained is he ma ix o
indices, also o size Mx9, which con ains in each ow he indices o he nea es neighbo s o he c ossing
poin ep esen ed in ha ow. Since we al eady ha e he dis ance ma ix, i only emains o see wha dis ances
mus be aken in o accoun and pe o m he calcula ions.
We will he e o e i e a e h ough each ow o hese ma ices o compu e he dis ance om each c ossing
poin o i s neighbo s. Since we ha e in he index ma ix he coo dina es o each neighbo , we s a by
de ining a se ies o complex ec o s ha go om he c ossing poin ha is being analyzed o each o he
neighbo s ound. This ec o allows us o ob ain he angle be ween he c ossing poin in ques ion and each o
he neighbo s. This angle be ween a c ossing poin and i s neighbo s will help o disc imina e he ollowing
cases, aking in o accoun he way in which he unc ion scipy measu emen s cen e o mass e u ns he
coo dina es o he cen e o mass:
i angle =90 hen
Neighbo s a e o he igh o he c ossing poin
end i
i angle =−90 hen
Neighbo s a e o he le o he c ossing poin
end i
i angle =0 hen
Neighbo s a e below he c ossing poin
end i
i angle =±180 hen
Neighbo s a e abo e he c ossing poin
end i

4.2 Measu e he dis ance be ween segmen ed c ossing poin s 49
A ole ance o 25ºis le wi h espec o hese angle alues in case hey a e no comple ely exac o in
case he e is a ce ain inclina ion o he h ead pa e n. All ha emains is o measu e he dis ance o he
nea es neighbo o all hose ound in each o he ou cases desc ibed. Thus, we would measu e he dis ance
o he nea es neighbo s o he le and igh , ha is, he dis ance be ween e ical h eads, as well as he
dis ance o he nea es neighbo s abo e and below, ha is, he dis ance be ween ho izon al h eads. All hese
dis ances a e al eady calcula ed in he co esponding ma ix, we jus ha e o access he co ec posi ions
which a e hose dis ances ha ep esen he dis ance o each c ossing poin o he selec ed neighbo s. This is
easy because we also ha e he index a ay. The ou dis ances measu ed by each c ossing poin as well as he
angles ha each c ossing poin makes wi h each o he neighbo s o in e es a e s o ed in ou new a ays
( wo o dis ances and angles o e ical h eads and he o he wo o he ho izon al ones). I no neighbo is
ound in any o he ou di ec ions, he co esponding dis ance and angle will no be added. This can happen
a edges, whe e he e will always be a leas one di ec ion in which no neighbo s exis . We can summa ize all
his g aphically in he ollowing igu e:
Figu e 4.10 G aphical ep esen a ion o he spa ial coun me hod.
This is epea ed o all ows o he index ma ix, ha is, o all localized c ossing poin s. Once we ha e
comple ed he p ocess, we ha e a ma ix wi h all he dis ances o in e es and ano he wi h all he angles o
in e es . Finally, we also add he possibili y o elimina ing spu ious dis ances ha could be he p oduc o
some poo ly segmen ed poin s. Tha is, i all he dis ances a e in a ce ain ange bu he e is some alue much
abo e o much below, i migh be con enien o elimina e hem. The op ion o passing an uppe pe cen ile
alue and a lowe pe cen ile alue as a pa ame e o he unc ion is p esen , so ha he dis ances abo e o
below he pe cen iles would be elimina ed. Finally, he o al dis ance is calcula ed as he a e age o all he
dis ances ha ha e emained in each o he wo di ec ions. Likewise, he a e age il o he image is calcula ed
by means o he a e age o all he angles in each o he wo di ec ions. As o he dis ance, once he a e age
dis ance in pixels has been ob ained, he a e age dis ance be ween h eads/cm is ob ained as ollows:
Ve ical coun ( h eads
cm ) = 200 (pix
cm )/Mean e ical dis ance (pix)(4.1)
Ho izon al coun ( h eads
cm ) = 200 (pix
cm )/Mean ho izon al dis ance (pix)(4.2)
The e o e, he desc ibed spa ial coun unc ion ecei es as inpu an image (and pe cen ile alues i desi ed)
and e u ns he densi y o e ical and ho izon al h eads pe cm, as well as he il o he e ical and ho izon al
h eads.
4.2.3 F equency coun
Ano he op ion ha we could conside is o ca y ou a equency analysis o he segmen a ion. The idea is
exac ly he same as he one desc ibed in p e ious sec ions: calcula e he 2D-DFT o he image and ob ain
he maximum o he spec um on he e ical and ho izon al axes. As we know, hese maximums ep esen
he alue o he e ical and ho izon al coun . Al hough we ha e p e iously seen how FT applied di ec ly o
he cu pa ches o he pla e has se e al limi a ions, we belie e ha i s applica ion o he segmen ed image
may be in e es ing, since a p io i hey will be much less noisy images in which he epe i ion pa e ns will be
mo e clea . E en so, FT may s ill no be able o deal well wi h cases whe e he dis ance be ween h eads is
50 Chap e 4. F om segmen a ion o h ead coun ing
i egula . The algo i hm o ob ain he h ead densi y om he FT was p o ided o us. I could be desc ibed in
he ollowing s eps:
•The spec um is calcula ed by he wo-dimensional DFT o N poin s using Py hon unc ions.
•
A p io i alues ha will de ine he sea ch a ea in he spec um a e se : a minimum coun o 4 h eads/cm,
a maximum coun o 25 h eads/cm and a maximum angle o inclina ion o he image o 25º. All ou
images i wi hin hese pa ame e s. This s ep is necessa y, as desc ibed in [16].
•The abo e alues a e con e ed o DFT poin s as ollows:
minFFT (DFT poin s) = 4( h eads
cm )
200 pix
cm
·N (4.3)
maxFFT (DFT poin s) = 25( h eads
cm )
200 pix
cm
·N (4.4)
•
Rec angles ha shapes he maximum sea ch a ea a e de ined. The size o hese ec angles will be gi en
by he p io alues se (once con e ed o DFT poin s). The minimum and maximum coun desc ibe
how long he ec angle will be, while he maximum angle de ines how wide i will be. Le us emembe
ha he spec um is conjuga e symme ic due o image eal alues, so i is enough o de ine a ec angle
be ween he o igin and he posi i e X axis and ano he be ween he o igin and he posi i e Y axis.
•
The maximum ound in each ec angle is ound and he Euclidean dis ance om he o igin o he
maximum o each axis is measu ed. The maximum on he X axis will gi e us he e ical dis ance,
while he maximum on he Y axis will gi e us he ho izon al dis ance.
•The abo e DFT-poin s dis ances a e con e ed o h eads pe cm ollowing he equa ions abo e.
We will es bo h he equency coun ing me hod and he spa ial coun ing me hod o see wha esul s we
ge wi h each o hem.
4.3 Measu e he coun ing e o wi h espec o he labels
Wi h all hese ing edien s we can al eady es how good ou me hod is when i comes o es ima ing he h ead
densi ies pe cm. To do his, we will compa e he densi y o e ical and ho izon al h eads pe cm ha we
ob ain by applying all he s eps desc ibed (segmen a ion using he U-Ne + bina iza ion + ob aining coun s
h ough spa ial o equency analysis) wi h he eal densi y o e ical and ho izon al h eads pe cm. The eal
dis ance be ween h eads will be ob ained by applying he spa ial coun ing me hod di ec ly o he labels and
wi h pe cen iles (100-0), ha is, wi hou disca ding any dis ance, since all he c ossing poin s a e co ec ly
segmen ed in he labels and he e a e no spu ious dis ances. We ha e c ea ed a unc ion ha measu es, o
each image, he di e ence be ween he eal coun and he one ob ained wi h ou me hod acco ding o wo
di e en me ics:
•
The oo mean squa e e o (RMSE) o a se wi h
n
images will be measu ed i s . This will gi e us an
absolu e e o alue, ha is, in how many h eads pe cm we a e making a mis ake.
RMSE =
u
u
n
∑
i=1
(| alueapp ox − alue eal)2
n(4.5)
•
The pe cen age e o o a se wi h
n
images will also be measu ed, ha is, wha pe cen age o e o we
a e making. To measu e his e o , he absolu e alue o he di e ence be ween he ac ual coun and
he es ima ed will be di ided by he ac ual alue. This me ic is mo e in e es ing because i allows
ela i izing he e o made based on he h ead densi y o each image. I is no he same o coun a
h ead mo e o less in an image wi h many h eads o wi h ew h eads.
%e o =
n
∑
i=1
| alueapp ox − alue eal|
| alue eal|
n·100 (4.6)
The unc ion will gene a e a g aph wi h he pe cen age e o o each image in he se o images ha we
pass o i as inpu . Also, i will e u n he a e age RMSE and pe cen age e o o all inpu images. We will
4.3 Measu e he coun ing e o wi h espec o he labels 51
use bo h he se and he alida ion se o measu e he e o and see how he whole p ocess wo ks. Al hough
es esul s a e included o comple eness, he choice o he bes model will be made based on he alida ion
esul s. Commen a his poin ha he es se is qui e ha d. O he 5 pain ings p esen in he es se , we
highligh he ollowing cha ac e is ics:
•
Pla e P001180 [39], by Velázquez, is one o hose in which FT does no wo k, as we saw in Figu e
3.2. I has a medium-high h ead densi y and he h eads in one di ec ion a e only no iceable as small
nodules on he c ossing poin s. I ’s a low noise pla e and he e a e some simila images in alida ion.
•
Pla es P07905 [36] and P07906 [37], by Manuel de P e , a e qui e complex pla es. They ha e a
ema kable noise le el and p oblema ic a eas, h eads ha appea and disappea and e y dis inc and
i egula h eads. They ha e a medium densi y wi h some a eas o sligh ly highe densi ies.
•
Pla es P998 [84] and P999 [85], by Mu illo, a e also complica ed and medium coun pla es. I has
h eads o di e en hicknesses, some o hem being qui e hin, and he e a e ew images wi h hese
cha ac e is ics in aining and alida ion. They also ha e a lo o noise, c acks and damage.
The e is no low densi ies pla es in es se , which i we emembe he dis ibu ion o he aining da a, we e
he p edominan ones in aining and alida ion se s. In addi ion, he quali ies o he images a e no he bes ,
al hough no all o hem a e bad. In o al, we ha e 104 es images, as discussed p e iously.
To pe o m some checks wi h alida ion and es images, we mus ake in o accoun he di e en models
ha we ha e o e alua e, as well as he di e en a ian s ha we can add in he p ocedu e. We can summa ize
i as ollows:
•
We ha e good esul s wi h he ge Une model wi h LR
1e−3
, wi h he ge Une 6 model, wi h he
ge Une KT model, and wi h he ge Une CS model. We will es all o hese, disca ding he ge Une
model wi h LR 1e−4 o ha ing poo e loss and accu acy esul s.
•
Di e en o ms o h esholding will be es ed: O su’s me hod scaling he h eshold by 1.2 (as desc ibed
in he co esponding sec ion) o local maxima il e ing me hod.
•
Spa ial coun ing and equency coun ing can be used. In p inciple, pe cen iles will no be applied o
elimina e spu ious dis ances in he spa ial coun , since we wan o see how all he de eloped algo i hms
wo k oge he . I we elimina e hese dis ances we would be masking he p oblem. La e , i will be
possible o deba e whe he o inco po a e hese pe cen iles o il e he dis ances o no .
The e o e, we ha e ou cases: bina ize wi h O su and use spa ial coun ing, bina ize wi h O su and use
equency coun ing, bina ize wi h he local maxima il e and use spa ial coun ing, o bina ize wi h he local
maxima il e and use equency coun ing. In he ollowing igu es we can see he e o s made in alida ion
and es se s in he ou cases men ioned. The weigh s ob ained in he 5 aining sessions o each model ha e
been aken in o accoun :
52 Chap e 4. F om segmen a ion o h ead coun ing
Valida ion RMSE Tes RSME
Valida ion pe cen age e o Tes pe cen age e o
Figu e 4.11 Box diag am o e o when O su bina iza ion and spa ial coun a e used.
In hese images we see he ep esen a ion o he RMSE and he pe cen age e o in he o m o a boxplo
[86]. These g aphs allow o s udy he da a wi h ease. Fo each model, a box is p esen ed, whose in e p e a ion
is as ollows:
•
Each box ep esen s he in e qua ile ange (IQR), ha is, in he a ea o he box a e he da a be ween
he i s qua ile and he hi d qua ile o he en i e dis ibu ion.
•
The cen al black line ep esen s he median o second qua ile. I i is loca ed in he cen e o he box,
hen he median ma ches he mean and mode o he dis ibu ion.
•The uppe and lowe whiske s ep esen he limi s o beginning he ou lie s and hei alue is limi ed
o 150% o he IQR.
•Diamonds indica e ou lie s, ha is, dis ibu ion alues ha exceed he IQR by mo e han 150%.
In his i s case we s udy he da a ob ained when using O su’s me hod o bina ize oge he wi h spa ial
coun ing o measu e he dis ance be ween c ossing poin s. I highligh s he g ea a iabili y ha exis s in he
ge Une KT model. This was o be expec ed, since we commen ed ha using such a high d opou a e he e
would be ainings whe e he e o would be low and o he s whe e he e o would be high. This beha io is
pe ec ly desc ibed by he wide box, ha is, he IQR is e y wide because he da a is e y dispa a e. The
good pe o mance o he ge Une KT CS model also s ands ou , since i is he one wi h he lowes mean e o
o all and exhibi s a beha io wi h ew a ia ions be ween one aining and ano he . I we look a which one
o e s he leas e o , he ge Une KT CS model is he bes in RMSE, bo h in es and alida ion. Also, ge Une
KT CS is he bes in pe cen age e o in alida ion, while he bes in pe cen age e o in es is he ge Une KT
model. As o he choice o he bes model we look a he alida ion da a, i is clea ha ge Une KT CS is
he one ha o e s he bes esul s in e ms o coun ing, al hough he ge Une KT model is close and does
no should be disca ded. The bes o all aining sessions is he hi d aining o he model ge Une KT CS
wi h an RMSE o 0.141 and a pe cen age e o o 1.17% in alida ion, ollowed by he hi d aining o he
model ge Une KT CS wi h a RMSE o 0.168 and a pe cen age e o o 1.37%. In es , he bes pe o mance
4.3 Measu e he coun ing e o wi h espec o he labels 53
is p o ided by he hi d aining o he ge Une KT model, wi h an RMSE o 0.191 and a pe cen age e o o
1.60%. The esul s using he scaled O su me hod and spa ial coun ing a e qui e sa is ac o y, ob aining eally
low alues. See now wha happens when Local MaxFil e bina iza ion and spa ial coun a e used:
Valida ion RMSE Tes RSME
Valida ion pe cen age e o Tes pe cen age e o
Figu e 4.12 Box diag am o e o when Local MaxFil e bina iza ion and spa ial coun a e used.
Again, he a iabili y o he ge Une KT model is no iceable, al hough in his case he e seems o exhibi
less a iabili y. The esul s a e simila : he bes model acco ding o alida ion esul s a e ge Une KT CS and
ge Une KT, wi h he ge Une and ge Une 6 models being close. In e ms o nume ical esul s, no no able
di e ences seems o appea . The lowes alida ion e o is p o ided by he hi d aining o he ge Une KT
CS model, wi h an RMSE o 0.147 and a pe cen age e o o 1.25%. On he o he hand, he lowes es e o
is p o ided by he hi d aining o he ge Une KT model, wi h an RMSE o 0.189 and a pe cen age e o
o 1.60%. These esul s a e p ac ically iden ical o hose ob ained in he p e ious case, howe e he e is a
no iceable ime di e ence be ween using he O su’s me hod o il e ing local maxima. Local maxima il e is
much slowe in execu ion, so in iew o he esul s we will conside ha he O su’s me hod is he one ha
p o ides he mos balanced esul s be ween pe o mance and compu a ional cos . Le ’s see now he esul s
when O su bina iza ion and equencial coun a e used:

54 Chap e 4. F om segmen a ion o h ead coun ing
Valida ion RMSE Tes RSME
Valida ion pe cen age e o Tes pe cen age e o
Figu e 4.13 Box diag am o e o when O su bina iza ion and equencial coun a e used.
When we include he equency coun in he compa ison, we see ha he esul s a e d as ically wo se. I
has been ound ha his me hod does no wo k well a all when i is applied o bina ized segmen a ion o some
o ou es images. The easons a e simila o wha we desc ibed when we men ioned he si ua ions in which
FT did no wo k well. Mos alida ion and es images a e complex and ha e some noise, which some imes
causes he segmen a ion o be somewha i egula . In addi ion, many o he images ha e i egula h ead
pa e ns ha p o okes segmen a ions wi h i egula dis ances be ween h eads, some hing ha , as we say,
makes FT no wo king well. Fo all his, we can conclude ha he spa ial coun ing me hod wo ks be e han
he equency coun ing o ou alida ion and es image se s. Howe e , we will use bo h me hods o compa e
hem o e a wide ange when we gene a e he densi y maps o ull pain ings. A his poin we can conclude
ha he bes combina ion o he alida ion se is o use he O su’s scaled me hod o bina ize segmen a ion
and spa ial coun ing o measu e he dis ance be ween c ossing poin s. Besides, we ha e checked ha he
hi d aining o bo h ge Une KT CS and ge Une KT (in ha o de ) o e s he bes alida ion esul s. O su
bina iza ion plus spa ial coun and he wo aining session mencioned o bo h ge Une KT CS and ge Une
KT a e also he bes o he es se , al hough alida ion esul s a e he ones ha ing in o accoun o choose
he bes model. In he ollowing igu e you can see he ep esen a ion o he e o made in he e ical and
ho izon al coun o some es and alida ion images using he weigh s o he hi d aining o he model
ge Une KT:
4.3 Measu e he coun ing e o wi h espec o he labels 55
Valida ion E o
Tes E o
Figu e 4.14 E o in each image using 3 d aining o ge Une KT model.
We highligh he ew e o s abo e 10% in he es images, wi h all e o s being abo e 10% caused by he
ho izon al coun . In alida ion, e o s a e also gene ally low. The e a e some cases whe e he alida ion e o
is abo e 10%. This may be due o he ac ha in alida ion we ha e all he Da a augmen a ion samples, so
he e a e samples wi h ex a o a ion ha usually p esen di icul ies. We can ep esen he samples in which
mo e e o occu s. I is ep esen ed in he ollowing igu es, om le o igh :
56 Chap e 4. F om segmen a ion o h ead coun ing
•The inpu image o be segmen ed.
•
The label co esponding o ha image. The e ical and ho izon al coun alues ob ained by applying
he spa ial coun me hod o said label a e indica ed.
•The segmen ed image ha he ne wo k p o ides as ou pu .
•The bina ized image using he scaling O su’s me hod ha we ha e desc ibed abo e. The e ical and
ho izon al coun alues ob ained by applying he spa ial coun ing me hod o he bina y image esul ing
a e indica ed.
Le ’s see he es samples in which he e is mo e han 8% e o o in e p e wha happens:
Figu e 4.15 Tes images whe e e o bigge han 8% occu s using ge Une KT model.
We can see ha he images wi h mo e han 8% e o a e, in gene al, qui e complex images. All o hem
ha e a high le el o noise, c acks and damage. In some, like he i s o he las , i is di icul e en wi h he
naked eye o de e mine how many h eads he e a e in each di ec ion. In addi ion, we see how he h ead
pa e ns a e i egula , being especially con lic ing in he las image, whe e we see hick h eads and e y
4.3 Measu e he coun ing e o wi h espec o he labels 57
ine h eads ha e en seem o ge los . The segmen a ion o he ne wo k in hese condi ions is no en i ely
sa is ac o y, al hough i does a good job conside ing he scena io in which we ope a e. You can see how
noisy and e y complex a eas a e included as c ossing poin s wi h an in e media e g ay le el, while he e a e
c ossing poin s ha ha e no been de ec ed. Le ’s also look a he alida ion samples whe e he e is mo e
han 12% e o o see wha happens:
Figu e 4.16 Valida ion images whe e e o bigge han 12% occu s using ge Une KT model.
In his case i is e iden ha he i s image has a conside able o a ion, some hing ha can di icul he
segmen a ion. In ac , we can see how nume ous alse poin s appea in he lowe igh co ne , possibly due o
bo h he o a ion and he p esence o c acks in he image. The o he wo images a e again complex. They
ha e a lo o noise and he e a e e y hick h eads ha b eak he pa e n. The noise causes some h eads o
seem as only one, as we see in he cen al a ea o he second image. This esul s in a segmen a ion whe e
nume ous poin s appea be ween he ue c ossing poin s ha cause he coun o go up, especially in he
e ical di ec ion. Now we ep esen he e o made in he e ical and ho izon al coun o he es and
alida ion images using he weigh s o he hi d aining o he model ge Une KT CS:
64 Chap e 5. Gene a ion o densi y maps
Figu e 5.1 Pla e P0998 shown wi h ImageJ. In ed, he egion o in e es .
ImageJ makes i easy o a ge he pixel alues ha de ine he egion o in e es . Speci ically, we need he
ow and column alue o he pixel in he uppe le co ne as well as he ow and column alue o he pixel
in he lowe igh co ne . Once we ha e he pa h o he pla e o ead i and he in o ma ion o he egion
o in e es , we p oceed o load he pla e. To manage he eading and p ep ocessing o he pla es, we we e
p o ided wi h a se ies o al eady p og ammed Py hon sc ip s. In hem, objec -o ien ed p og amming is
used o manage he comple e pla e as an objec , which has di e en a ibu es and me hods ha makes easy
ope a ing wi h i . When loading he pla e wi h hese lib a ies we can access o some a ibu es ob ained om
he me ada a o he . i ile o he pla e, highligh ing he ollowing:
•Numbe o ows in he image, ha is, he heigh o he pain ing in pixels.
•Numbe o columns in he image, ha is, he wid h o he pain ing in pixels.
•The esolu ion wi h which he pla e was digi ized, in pixels/cm.
Wi h hese h ee alues we can ope a e o ob ain in o ma ion abou he physical dimensions o he pain ing.
Speci ically, we can ob ain he heigh and wid h o he pla e in cm, di iding he size in pixels by he esolu ion.
Besides, he wid h and heigh o he egion o in e es in pixels a e ob ained. To ob ain he heigh o he
egion o in e es (numbe o ows), he di e ence be ween he alue o he ow o he inal pixel (lowe igh
co ne ) and he alue o he ow o he ini ial pixel (uppe le co ne ) is ob ained. Likewise, o ob ain he
wid h o he egion o in e es (numbe o columns), he di e ence be ween he alue o he column o he
inal pixel and he alue o he column o he ini ial pixel is ob ained.
5.1.2 Ge ing alues o mo e ac oss he pla e
Once he image has been ead and he egion o in e es has been de ined, i is necessa y o se and calcula e
ano he se ies o alues ha will help us o mo e ac oss he en i e pain ing and ob ain he coun . On he
one hand, we ha e he alues and a ibu es ha will se e o p ep ocess he ex ac ed pa ches and on he
o he he alues and a ibu es ha will se e o calcula e he numbe o necessa y windows in which we will
subdi ide he image.
P ep ocessing alues
The pa ches used o ain he ne wo k ha we e p o ided o us had been p ep ocessed. Tha is, hey applied
p ep ocessing o imp o e he pa ches appea ance and so acili a e labeling and lea ning o he ne wo k when
hese pa ches whe e c opped om he pla es. Fo his eason, we we e also p o ided wi h he lib a ies al eady
p og ammed o ca y ou his p ep ocessing in he di e en windows in which we will subdi ide he image.

5.1 Func ion o gene a e densi y maps 65
The p ep ocessing consis s o a local mean il e , a local s anda d de ia ion il e and a ail clipping o
he his og am o he image g ay le els. The local mean il e consis s o calcula ing he mean o he pixels
in a window o a ce ain size, sub ac ing he mean alue ob ained om all he pixels in ha window. The
local s anda d de ia ion il e consis s o calcula ing he alue o he de ia ion o he pixels in a window
o a ce ain size, di iding he alue o all he pixels in he window by he calcula ed de ia ion. The ail
clipping o he his og am is pe o med o disca d i s ails, so ha i he image is subsequen ly scaled, i
a oids e y high o e y low anges o be assign o ew alues. The p ep ocessing windows we e se o 27
pixels, as his is he alue hey p e iously used o ex ac he aining pa ches. In addi ion, a ma gin is aken
a ound he pa ch o be p ep ocessed o imp o e i s esul when pe o ming he p ep ocessing. The ma gin
mus be a leas hal o he window. Taking in o accoun ha we pe o m a double il e ing wi h 27 pixel
windows and ha o each il e ing he ma gin mus be a leas hal , he o al ma gin o bo h il e s mus be
a leas wice he ma gin o each o he il e s, his is, 27 pixels. We ha e se he alue o he ma gin o 30
pixels. This alue is su icien and i is he same alue ha he ones used o ob ain he aining pa ches. In
addi ion, a esampling is pe o med i he esolu ion o he image is no adequa e. Le us emembe ha all
he pa ches ha we e p o ided we e p ep ocessed and hei esolu ion adjus ed o 200 pixels/cm, he e o e all
he windows in which we di ide he image mus also be p ep ocessed pa ches in he same way and wi h a
esolu ion o 200 pixels/cm . Fo his, he image a ibu e a ge Resolu ion is accessed and se o 200 pixels/cm.
On he o he hand, i is necessa y o de ine he di ision in o windows o he pla e o coun each egion
sepa a ely. To ob ain he densi y o h eads pe cm, we need each window in which we subdi ide he image
o ha e physical dimensions o 1cm x 1cm. The e o e, he size o he window in pixels will be gi en by he
scanning esolu ion o he pla e. In addi ion, we can add some o e lap when sc olling he window o imp o e
he inal esul and ob ain smoo he densi y maps. To con ol his o e lap we use he shi ac ion a iable,
which measu es how much he window size ad ances in each i e a ion. The shi will be a ac ion be ween 0
and 1, so a shi o 1 indica es ha he e is no o e lap because he window ad ances i s posi ion by as many
pixels as i s size. This alue mus be chosen acco ding o he dimensions o he pla e s udied: i he pla e is
small, a low shi can be used o ob ain densi y maps wi h high esolu ion, while i he pla e is e y la ge, a
high shi is mo e ecommended o e i he p ocess o be so leng hy. The shi ac ion alues used in each
p ocessed pla e ha e been ag eed wi h he u o o he wo k. Once he shi ac ion is ixed and he size o
he window in pixels is ob ained om he esolu ion, he numbe o pixels o o e lap is ob ained, ha is, how
many pixels he window ad ances in each i e a ion in ows o in columns:
Shi (pixels) = Size window (pix)·Shi ac ion
Wi h all his we can now subdi ide he egion o in e es o he pla e in o windows. The undamen al idea
is o ob ain he numbe o ows and columns ha he densi y maps will ha e, so ha each pixel o he densi y
maps physically ep esen s a squa e window wi h a side o 1 cm. To ob ain he numbe o ows, we di ide he
heigh o he egion o in e es (in pixels) by he numbe o pixels ha he window ad ances in each i e a ion
(shi in pixels). Likewise, o ob ain he numbe o columns, we di ide he wid h o he egion o in e es
(in pixels) by he numbe o pixels ha he window ad ances in each i e a ion (shi in pixels). The window
ad ance alue is he same o ows and columns. The windows, like he aining pa ches, a e squa es wi h
physical dimensions o 1 cm on each side. In bo h di isions he lowe in ege is aken in o de o ha e an
in ege numbe o ows and columns. Taking he lowe in ege ensu es ha we do no go ou side he egion
o in e es . Once he numbe o ows and columns o he densi y maps is ob ained, he co esponding emp y
ma ices wi h hose dimensions a e cons uc ed.
The ollowing image shows a g aphical desc ip ion o his di ision in o windows. The Mu illo P998 pla e,
which has a esolu ion o 200 pixels/cm, has been aken as a e e ence. Also, a shi o 1/2 has been se , ha
is, 50% o he window size. The e o e, each window wi h a side o 1cm has a size o 200x200 pixels. Each
yellow o blue squa e ep esen s a window. As we can see, hey o e lap 50% (100 pixels) due o he se shi .
The di e ence in colo s is only o allow he o e lap o wo consecu i e windows o be di e en ia ed in he
example image. This o e lap occu s bo h by ows and by columns, as exempli ied in he image:
66 Chap e 5. Gene a ion o densi y maps
Figu e 5.2 Di ision in windows o pla e P998 by Mu illo.
Coun ing ac oss he pain ing
Now we di ide he pla e in o 1cm side windows using a double
o
loop ha mo e ac oos as many ows and
columns he densi y maps ha e. Speci ically, o a gi en ow all columns will be i e a ed. Fo each ow and
column index o he densi y maps gi en by he double loop, he equi alen loca ion on he pla e is ob ained.
To do his we mul iply he ow and column index o he loop by he alue o he shi . Howe e , i should
also be no ed ha he o igin o he densi y map coo dina es is loca ed in he uppe le co ne o he egion
o in e es . The e o e, o ob ain he eal index in ow and column o he pla e, i is necessa y o add o he
ow and column o he ini ial pixel o he egion o in e es he ow and column indica ed by he double loop
once ans o med o pla e pixel coo dina es. This ow and column alue ep esen s he op le co ne o each
window o p ocess. The ollowing ope a ions a e pe o med o each window:
•
A cu is made o ob ain a pa ch o 1cm on each side, ha is, wi h as many pixels as he esolu ion o he
image o iginally. Those pixels will be coun ed down and o he igh o he e e ence pixel (desc ibed
in he p e ious pa ag aph) ha ep esen s he uppe le co ne .
•
I he esolu ion is no 200 pixels/cm, a esampling is pe o med o adjus he c opped pa ch o ha
esolu ion. The e o e, a his poin we ha e a pa ch o 1cm side and 200x200 pixels. This ma ches he
pa ches he U-Ne was ained on.
•The c opped pa ch is p ep ocessed as p e iously desc ibed.
•
The c opped pa ch is no malized o be in he ange [0-1]. Fo his, we i s sub ac he minimum alue
o he image om all he pixels and, la e , we di ide all he pixels by he maximum alue o he image.
•We use some o he p e iously ained U-Ne models o ob ain he segmen a ion o he pa ch.
•
The segmen a ion is bina ized using O su’s me hod and scaling he h eshold by 1.2, as desc ibed in
he p e ious chap e .
•
The spa ial coun ing me hod wi hou elimina e any dis ance is applied o ob ain he numbe o e ical
and ho izon al h eads in ha pa ch, ha is, he densi y o h eads pe cm in he e ical and ho izon al
di ec ion.
•
Addi ionally, he h ead densi y pe cm will also be calcula ed using he equency analysis me hod
desc ibed. Speci ically, i will be used o ob ain he coun om he segmen a ion and also o ob ain he
coun by di ec ly applying he FT o he o iginal image once i has been c opped and p ep ocessed. In
his way we can see he densi y maps ob ained in he ee cases o compa ison.
•
The esul o he e ical and ho izon al coun ob ained by each o he h ee ways (di ec equency
analysis o he image, equency analysis o he image segmen a ion o spa ial coun o he image
segmen a ion) is s o ed in he inpu o he co esponding ma ices o gene a e he densi y maps. In
5.2 Algo i hm imp o emen s 67
his way we will ha e he alue o he numbe o h eads pe cm o each pa ch o he 1cm side squa e.
In addi ion o he numbe o h eads pe cm, we also ob ain he angle o de ia ion o he h eads in
ha image om he spa ial coun ing me hod. This o he me ic is also o in e es as desc ibed a he
beginning o his documen .
•
In o de o be able o ollow he p ocess and check he pe o mance o all he algo i hms in ol ed, he
ob ained pa ch, he segmen a ion and he h esholding o he segmen a ion a e some imes ep esen ed.
We also p in he alue o he coun ob ained wi h he h ee me hods.
Once he double loop has inished we can ep esen he densi y maps as an image, o e ing a simple
in e p e a ion o hem h ough colo maps. In addi ion, we can also gene a e some his og ams om he
densi y maps o check he dis ibu ion o he numbe o h eads pe cm in each o he di ec ions.
5.2 Algo i hm imp o emen s
In his sec ion we will desc ibe wo a ian s o he p e ious algo i hm ha we e de eloped o imp o e he
compu a ion ime needed o ob ain he densi y maps o a pain ing. Ob aining he densi y maps can ake a
long ime, depending on he size o he pain ing and he capabili ies o he machine whe e i is unning on.
A he end o his sec ion we will compa e he o iginal algo i hm and he wo imp o emen s p oposed in his
sec ion in e ms o execu ion ime.
5.2.1 Build enso s o ake ad an age o GPU capabili ies
The i s imp o emen consis s o building enso s o be able o ob ain he ne wo k p edic ion o se e al
images simul aneously. Un il now, each pa ch was passed o he ne wo k o ob ain i s co esponding seg-
men a ion indi idually. Howe e , we could g oup se e al pa ches o ob ain he segmen a ion o all o hem
simul aneously. I we g ouped N pa ches, he ne wo k would ecei e as inpu a enso o (N,200,200,1), ha
is, N images o 200x200 pixels in g ay scale.
To implemen his we build ow enso s, ha is, o each ow we c ea e a enso wi h all he ex ac ed
pa ches in all he columns o ha ow. Once he ow enso is buil , i is passed o he ne wo k o ob ain a
enso wi h he segmen a ion o all he pa ches o each ow, sa ing a lo o ime when ope a ing wi h enso s
ins ead o wi h indi idual images. Subsequen ly, each image o he ow enso and he segmen a ion enso
o ha ow is accessed o pe o m he coun as we did un il now.
5.2.2 Use mul ip ocessing lib a ies
The second imp o emen , based on he p e ious one, consis ed o using mul ip ocessing lib a ies o ake
ull ad an age o he capabili ies o he machine whe e he algo i hm is execu ed. Speci ically, we use he
mul ip ocessing [88] lib a y and he h5py [89] lib a y o ile managemen o sa e memo y.
The idea o his e sion o he algo i hm is o p ocess se e al ows o he pla e simul aneously, speci ically
as many ows as he e a e co es in he p ocesso o he compu e whe e i is execu ed. Now, pa ches o
se e al ows a e c opped and p ep ocessed a he same ime, sa ing a conside able amoun o ime. To do
his, g oups o as many ows as he machine has p ocesso s a e aken simul aneously. Each ime a g oup o
ows is p ep ocessed, he p ep ocessed ow enso s a e sa ed in an .hd 5 ile. Each enso has a pa icula
iden i ie ha allows he in o ma ion o be e ie ed la e . This is done because each p ep ocessed ow enso
can was e a lo o memo y, so no e e y machine could ha e all he p ep ocessed enso s s o ed in mem-
o y. hd 5 iles allow you o w i e and ead om memo y e y quickly and e icien ly, being pe ec o his ask.
Once he en i e pla e has been p ep ocessed, we will ead he enso s om he .hd 5 ile and pass hem
h ough he ne wo k o ob ain hei segmen a ion. The simples way would be o ead he enso s one by one
and ob ain he segmen a ion o each one. Howe e , we could g oup hese enso s o build a mega- enso . The
size o he mega- enso would be limi ed by he amoun o memo y ha he GPU in ques ion has, as we a e
looking o build he la ges possible enso ha allows ou machine’s abili y o ge he mos ou o he GPU.
Fo his, he i s hing is o ob ain in o ma ion abou he ee memo y ha he GPU has. Using he n idia
smi lib a y we can ge he amoun o ee memo y. Likewise, we can consul in Py hon he size in memo y
ha each 200x200 pixel image occupies. By di iding he ee memo y by he size o each image, we would
ob ain he maximum numbe o images ha we could pass o he ne wo k a he same ime. In p ac ice, we
68 Chap e 5. Gene a ion o densi y maps
ha e mul iplied his alue by 80% o ne e cause an o e low in he GPU memo y.
Wha we do hen is ead se e al ow enso s simul aneously, aking ca e ha he memo y was e o he
samples o all he enso s does no exceed he h eshold de ined by he GPU memo y. These enso s a e
joined in a mega- enso ha is passed o he ne wo k o ob ain he segmen a ion o all hose images. The
segmen a ion enso s a e also sa ed in ano he .hd 5 ile o be able o ead hem la e . This is epea ed un il
he e a e no image enso s le o ead. Be ween each g oup o enso s he GPU memo y is cleaned o a oid
o e low. We ha e e i ied ha his is necessa y because i no Tenso Flow h ows a memo y excep ion, since
i enso s a e no emo ed om he memo y o he GPU hey emain s o ed and accumula ed. In case he
machine does no ha e a GPU, he ne wo k p edic ion will be much slowe , since i mus be done using he
CPU. I a machine does no ha e GPU, each ow enso will be ead sepa a ely and i s p edic ion will be
ob ained.
Finally, we also a y he way in which he segmen ed images a e analyzed in o de o pa allelize he
ope a ions as much as possible. Now we will ead se e al image enso s and segmen a ion enso s a he
same ime (as many as he machine has CPU co es). Th ough a loop, bo h enso s a e eco e ed, h esholding
he segmen a ion o each image and ob aining he coun alue h ough equency and spa ial analysis and
pe o ming he equency analysis di ec ly om he co esponding pa ch. The ad an age is ha you will be
doing his on se e al pai s o images (o iginal images and segmen a ion) om enso s a he same ime. The
h ead coun and angle es ima ion esul s a e s o ed in ma ices o be ep esen ed la e .
Wi h his a ian o he algo i hm we ge he mos ou o bo h he CPU and he GPU o each machine. A
CPU-only a ian o his algo i hm has also been de eloped, ha is, i uses he CPU o ne wo k p edic ion
as well. This a ian is in ended o be used on machines ha do no ha e a GPU, al hough he p ocess
slows down a lo . Howe e , we hink i is necessa y o be es ed, since we a e in e es ed in cha ac e izing
he analysis o pla es in e ms o compu a ion ime. To do his, we will compa e how long i would ake
o gene a e he densi y maps o di e en pain ings wi h di e en sizes and on di e en machines, some
wi h CPU and o he s wi h CPU+GPU. Tha is why we will p esen wo compa isons. The i s will se e o
measu e he compu a ion ime o di e en pla es using each o he h ee e sions o he algo i hm p esen ed.
The bes e sion will be selec ed and ano he compa ison o he execu ion ime will be made o di e en
pain ings on di e en machines wi h CPU and GPU cha ac e is ics o all kinds.
5.2.3 Compa ison o he h ee a ian s o he algo i hm
Fi s o all, we execu e he h ee a ian s o he algo i hm on he machine ha we ha e been using o ain
he ne wo k. Recall ha his machine has an In el Xeon E5-2630 4 p ocesso wi h 40 CPU Co es and wo
NVIDIA Tesla P100 16GB g aphics ca ds as GPU. I will be es ed on he ollowing pain ings:
•
P07905 by Manuel de P e [36]. I has dimensions o 6095 ows by 7848 columns and a esolu ion o
200 pixels/cm. A shi ac ion o 1/10 is applied.
•
P001180 by Velázquez [39]. I has dimensions o 44600 ows by 7100 columns and a esolu ion o
200 pixels/cm. 1/4 is applied.
•
P999 by Mu illo [85]. I has dimensions o 5687 ows by 7290 columns and a esolu ion o 200
pixels/cm. A shi ac ion o 1/10 is applied.
•
P007701 by Pa e [90]. I has dimensions o 8060 ows by 6395 columns and a esolu ion o 200
pixels/cm. A shi ac ion o 1/10 is applied.
•
P001171 by Velázquez [91]. I has dimensions o 34468 ows by 44507 columns and a esolu ion o
149 pixels/cm. A shi ac ion o 1/2 is applied.
•
P1114 by Ribe a [34]. I has dimensions o 17815 ows by 23622 columns and a esolu ion o 118
pixels/cm. A shi ac ion o 1/2 is applied.
The i s h ee pla es ha e samples in he es se . The las h ee a e p e iously un eleased and we e no
pa o any o he ne wo k’s aining se s. As we can see, he e a e small pain ings ha ha e been assigned
a low shi , like he i s one, while o he s a e huge and ha e been assigned a highe shi ac ion, like he
penul ima e one. This is in e es ing o see he necessa y p ocessing imes in each case. In he ollowing able
we collec he compa ison o execu ion imes o he comple e p og am wi h each o he h ee a ian s o he
algo i hm p esen ed. The i s a ian , whe e he ow enso s we e buil , will be called he Tenso e sion.
The second a ian , in which mul ip ocessing lib a ies a e used, will be called he Mul ip ocessing e sion:
5.2 Algo i hm imp o emen s 69
Table 5.1 Execu ion ime o each e sion o he algo i hm.
Execu ion ime o each e sion o he algo i hm
Pla e O iginal algo i hm Tenso e sion Mul ip ocessing e sion
P07905 7h 6min 5h 52min 28min
P001180 9h 48min 8h 1min 37min
P999 7h 11min 5h 54min 29min
P007701 11h 1min 9h 22min 46min
P001171 1day 1h 20min 21h 2min 1h 49min
P1114 14h 34min 12h 12min 58min
As we can see, he execu ion ime o he o iginal algo i hm is qui e high, e en on a powe ul machine
like he one used. Using he Tenso a ian educes p ocessing ime by 16% on a e age ac oss all pain ings.
Howe e , we see ha by using he mul ip ocessing lib a ies, he compu a ion ime is educed by mo e han
90%. On he es ed machine, wi h 40 CPU co es, 40 ows o he pla e a e p ocessed simul aneously. Also, by
building he mega- enso s we a e maximizing he use o GPU capabili ies. Al hough i is ue ha esou ces
a e be e used in e ms o GPU, he main eason o he d as ic dec ease in execu ion imes is in he o al
and pa allel use o he CPU. C opping and p ep ocessing asks a e qui e expensi e o CPU, so he ime is
no o iously educed by pa allelizing hem.
Nex , we will y o cha ac e ize he compu a ion ime equi ed by he pain ings men ioned be o e when
hey a e p ocessed on machines wi h di e en capabili ies. They will be es ed on bo h powe ul machines
and lap ops, wi h and wi hou using GPUs. We y o gi e an idea o he ime ha may be equi ed o p ocess
pla es o di e en sizes (such as hose p e iously selec ed) depending on he a ailable machine. No e ha we
will always use he mul ip ocessing algo i hm o imp o e imes as much as possible. The machines used a e
he ollowing:
•PC Sedna: In el Xeon E5-2630 4 40 co es CPU + 16GB GPU Tesla P100.
•PC Sedna wi hou GPU - In el Xeon E5-2630 4 - 40 co es CPU (wi hou using GPU).
•PC Azken - INTEL i9 24 co es CPU + 48 GB GPU NVIDIA RTX A600.
•PC Azken wi hou GPU - INTEL i9 24 co es CPU (wi hou using GPU).
•MacBook P o 2021 - 10 co es CPU + 16 co es GPU (16GB).
•MacBook P o In el i5 2016 - 4 co es CPU (wi hou GPU).
We collec in he ollowing able he execu ion imes o each one o he pain ings in he machines p esen ed:
Table 5.2 Execu ion imes o he mul ip ocessing algo i hm on di e en machines.
Execu ion imes o he mul ip ocessing algo i hm on di e en machines
Compu e P07905 P001180 P999 P007701 P001171 P1114
Sedna GPU 28min 37min 29min 46min 1h 49min 58min
Sedna no GPU 1h 30min 1h 57min 1h 34min 2h 20min 6h 21min 2h 42min
Azken GPU 23min 33min 23min 39min 1h 30min 46min
Azken no GPU 47min 1h 3min 48min 1h 12min 2h 41min 1h 24min
MacBookP o 2021 M1P o (GPU) 42min 55min 42min 1h 3min 2h 21min 1h 16min
MacBookP o 2016 In el (no GPU) 4h 56min 6h 35min 5h 7min 7h 34min 15h 24min 8h 25min
We can see how he di e ences a e no able depending on he machine on which i is execu ed. The
conclusions ha we can d aw a e he ollowing:
•
A ull capaci y, he Azken machine is he one ha o e s he bes esul s. No su p isingly, i has he
mos powe ul CPU and GPU in he en i e compa ison.
•
Al hough he di e ence be ween using o no using he GPU can in ol e up o h ee imes he ime, we
see ha he main di e ence is in he use o a powe ul CPU. I is ue ha he ask o ob aining he
segmen a ion p edic ions is g ea ly accele a ed when using a GPU. Howe e , he ha des ask in he
en i e pipeline is he p ep ocessing o he pa ches. P ep ocessing consumes a lo o CPU esou ces, so

70 Chap e 5. Gene a ion o densi y maps
CPU capabili es a e he bo leneck mo e han GPU. The Sedna and Azken machines ha e e y powe ul
CPUs which mean ha , e en wi hou using he GPUs o ob ain he neu al ne wo k p edic ions, he
imes a e qui e accep able.
•
Coun ing o la ge pla es can be go e en on lap ops, hough hey need o ha e good ha dwa e and
p e e ably a GPU ha can un Tenso Flow. This is he case o he MacBookP o wi h M1 P o chip.
Wi h his chip i is possible o use he lap op’s GPU wi h Ke as and Tenso Flow lib a ies. I we add o
his a ai ly powe ul CPU ( o a lap op) o which we a e aking ull ad an age, esul a e also good.
•
Wi h MacBookP o wi h In el i5 imes inc ease exponen ially. This lap op does no ha e a GPU and i s
quad-co e p ocesso is qui e limi ed o asks o his demand. I would no be ad isable o wo k wi h
machines o his ype because hey ake almos i e hou s o small pla es such as P07905 pla e.
Fo all he esul s p esen ed, we conclude ha he p oposed me hod o ob ain he densi y maps o a pain ing
equi es ce ain compu a ional capabili ies o be execu ed in logical imes. The algo i hm has been op imized
as much as possible, implemen ing wo imp o emen s ha ha e signi ican ly educed he ime i akes o ob ain
he densi y maps by mo e han 90%. The main equi emen is a powe ul CPU, since he mos demanding
calcula ions equi e high compu ing capaci ies o be pa allelized. In addi ion, i is highly ecommended o
ha e a GPU compa ible wi h Ke as and Tenso Flow o educe he p edic ion ime o he neu al ne wo k as
much as possible.
5.3 Densi y maps ob ained in some expe imen s
In his las sec ion we will see he esul s ob ained when applying he p oposed algo i hm o comple e pla es.
The densi y maps ob ained o a se ies o pain ings o he p o ided collec ion will be p esen ed below. This
sec ion will also help us o compa e he esul s ha would be ob ained in he ollowing h ee scena ios:
•
When pe o ming a equen ial analysis o he pla e. This was he mos used me hod un il now and i is
he one ha has been used in so wa es such as A acne.
•When pe o ming a equen ial analysis o he segmen a ion ob ained wi h he neu al ne wo k.
•When pe o ming a spa ial analysis o he segmen a ion ob ained wi h he neu al ne wo k.
Besides, he densi y maps will be ob ained using he ge Une KT model and he weigh s om i s hi d
aining as well as using he ge Une KT CS model and he weigh s om i s hi d aining. We will use he
ollowing pain ings o ob ain hei densi y maps:
•
Two bunches o g apes wi h a ly ( e e ence P07905) by Manuel de P e [36]. I has dimensions o 6095
ows by 7848 columns and a esolu ion o 200 pixels/cm. A shi ac ion o 1/10 is applied. The e a e
samples d awn om his pain ings in he es se .
X- ay pla e Example pa ch
Figu e 5.3 P07905 pla e and example pa ch.
5.3 Densi y maps ob ained in some expe imen s 71
•
Two bunches o g apes ( e e ence P07906) by Manuel de P e [37]. I has dimensions o 6192 ows by
7968 columns and a esolu ion o 200 pixels/cm. A shi ac ion o 1/10 is applied. The e a e samples
d awn om his pain ing in he es se .
X- ay pla e Example pa ch
Figu e 5.4 P07906 pla e and example pa ch.
•
P ince Bal asa Ca los, on Ho seback ( e e ence P001180) by Velázquez [39]. I has dimensions o
44600 ows by 7100 columns and a esolu ion o 200 pixels/cm. A shi ac ion o 1/4 is applied. No
samples o his pain ing ha e been used so a .
X- ay pla e Example pa ch
Figu e 5.5 P001180 pla e and example pa ch.
72 Chap e 5. Gene a ion o densi y maps
•
The a ewell o he p odigal son ( e e ence P998) by Mu illo [84]. I has dimensions o 5633 ows by
7086 columns and a esolu ion o 200 pixels/cm. A shi ac ion o 1/10 is applied. The e a e samples
d awn om his pain ing in he es se .
X- ay pla e Example pa ch
Figu e 5.6 P998 pla e and example pa ch.
•
The dissipa ion o he p odigal son ( e e ence P999) by Mu illo [85]. I has dimensions o 5687 ows
by 7290 columns and a esolu ion o 200 pixels/cm. A shi ac ion o 1/10 is applied. The e a e
samples d awn om his pain ing in he es se .
X- ay pla e Example pa ch
Figu e 5.7 P999 pla e and example pa ch.
5.3 Densi y maps ob ained in some expe imen s 73
•
Adam and E e ( e e ence P001692) by Rubens [38]. I has dimensions o 34035 ows by 25874 columns
and a esolu ion o 138 pixels/cm. A shi ac ion o 1/2 is applied. The e a e samples d awn om
his pain ing in he aining se .
X- ay pla e Example pa ch
Figu e 5.8 P001692 pla e and example pa ch.
•
The Abduc ion o Eu opa ( e e ence P001693) by Rubens [92]. I has dimensions o 35552 ows by
38583 columns and a esolu ion o 188 pixels/cm. A shi ac ion o 1/2 is applied. The e a e samples
d awn om his pain ing in he aining se .
X- ay pla e Example pa ch
Figu e 5.9 P001693 pla e and example pa ch.
80 Chap e 5. Gene a ion o densi y maps
coun and he spa ial coun o e good esul s. This i s pa ch is a complex image, wi h noise, h eads o
di e en wid hs and no comple ely equidis an , some hing ha can make i di icul o he FT o ob ain he
coun di ec ly om he c opped pa ch spec um. In he second pa ch all h ee me hods wo k ine. Rega ding
he models compa ison, bo h models seems o do a good job, al hough ge Une KT p o ides a mo e compac
and s able segmen a ion, since all poin s ha e he same shape.
5.3.2 P07906 Resul s
Now we p esen he densi y maps ob ained o he P07906 pla e. We s a wi h he densi y maps ob ained by
pe o ming he equency analysis o he pla e:
Ve ical densi y map Ho izon al densi y map
Figu e 5.22 P07906 densi y maps pe o ming a equen ial analysis o he pla e.
Nex , le ’s see hose densi y maps when pe o ming he equen ial analysis o he segmen a ion:
Ve ical densi y map Ho izon al densi y map
Figu e 5.23 P07906 densi y maps pe o ming a equen ial analysis o he segmen a ion wi h ge Une KT.

5.3 Densi y maps ob ained in some expe imen s 81
Ve ical densi y map Ho izon al densi y map
Figu e 5.24
P07906 densi y maps pe o ming a equen ial analysis o he segmen a ion wi h ge Une KT CS.
Thi d, we also p esen he densi y maps by pe o ming a spa ial analysis o he segmen a ion:
Ve ical densi y map Ho izon al densi y map
Figu e 5.25 P07906 densi y maps pe o ming a spa ial analysis o he segmen a ion wi h ge Une KT.
Ve ical densi y map Ho izon al densi y map
Figu e 5.26 P07906 densi y maps pe o ming a spa ial analysis o he segmen a ion wi h ge Une KT CS.
82 Chap e 5. Gene a ion o densi y maps
We can also ep esen he inclina ion o he h eads in each a ea o he pla e, since his alue has been
ob ained when pe o ming he spa ial coun :
Ve ical angle map Ho izon al angle map
Figu e 5.27 P07906 Angle de ia ion in deg ees wi h ge Une KT /ge Une KT CS.
Las ly, le ’s see he compa ison o he e ical and ho izon al coun his og ams wi h each o he h ee
me hods:
FT Ho izon al coun ing FT Segmen a ion Ho izon al coun ing Spa ial Ho izon al coun ing
FT Ve ical coun ing FT Segmen a ion Ve ical coun ing Spa ial Ve ical coun ing
Figu e 5.28 P07906 Coun ing his og ams wi h ge Une KT.
5.3 Densi y maps ob ained in some expe imen s 83
FT Ho izon al coun ing FT Segmen a ion Ho izon al coun ing Spa ial Ho izon al coun ing
FT Ve ical coun ing FT Segmen a ion Ve ical coun ing Spa ial Ve ical coun ing
Figu e 5.29 P07906 Coun ing his og ams wi h ge Une KT CS.
Fo his pla e we see ha he p e ious conclusions a e epea ed. The equency analysis o he pla e
gene a es nume ous in ense blue zones a he op o he e ical densi y map and on he sides o he ho izon al
densi y map (see Figu e 5.22). This indica es ha he equency analysis is no wo king as expec ed. The
o he wo me hods imp o e his beha io , especially he spa ial coun which, again, is he one ha o e s he
bes esul s (see Figu es 5.25 and 5.26). In his case, we can app ecia e some mo e no iceable di e ence
be ween using one model o ano he . The ge Une KT model pe o ms be e han he ge Une KT CS model
in some a eas in he uppe le egion o he e ical densi y map. The il maps indica e ha in his case he e
is some mo e no iceable o a ion, especially in he le pa o he ho izon al densi y map and in some bands
o he e ical densi y map. Finally, in he his og ams we ind he same beha io o he p e ious case. Le ’s
also see some pa ch examples:
Example wi h ge Une KT model
Example wi h ge Une KT CS model
Figu e 5.30 P07906 examples.
84 Chap e 5. Gene a ion o densi y maps
We see ha he images a e e y simila , since he can as o he pla es a e simila . In he i s pa ch he
equency analysis o he pla e is qui e w ong in he e ical coun , while be ween he equency and spa ial
coun o he segmen a ion he e a e almos wo h eads o di e ence. In he segmen a ion he e is a e ical
h ead ha has no been comple ely segmen ed, al hough in iew o he pa ch i is no clea ha his h ead
exis s because he e a e a eas whe e i seems o exis and a eas whe e i does no . In ac , i you y o coun
he numbe o e ical h eads in he pa ch he e appea o be 14 ho izon al h eads, an in e media e esul
be ween bo h esul s. In he second pa ch he spa ial coun gi es a small e o , since i coun s pa o a e ical
h ead less. The wo equency coun s seems o wo k a li le bi be e . As we can see, he pa e n o he
h eads is qui e homogeneous, a si ua ion whe e he FT wo ks co ec ly as we expec , Also, he FT is able o
in e he pa e n om such noisy segmen a ion.
5.3.3 P001180 Resul s
Nex we p esen he densi y maps ob ained o he P001180 pla e. Le us emembe ha his pla e is one
o hose whe e he applica ion o FT o he images di ec ly ex ac ed om he pla e does no wo k well a
all. As o P07905 and P07906 pla es, some samples om his pla e a e p esen in he es se . Le ’s see he
densi y maps ob ained by pe o ming he equency analysis o he pla e:
Ve ical densi y map Ho izon al densi y map
Figu e 5.31 P001180 densi y maps pe o ming a equen ial analysis o he pla e.
5.3 Densi y maps ob ained in some expe imen s 85
Nex , le ’s see hose densi y maps when pe o ming he equen ial analysis o he segmen a ion. The i s
wo maps ( om le o igh ) belong o ge Une KT model, while he wo las maps belong o ge Une KT CS
model:
Ve ical densi y map Ho izon al densi y map Ve ical densi y map Ho izon al densi y map
Figu e 5.32 P001180 densi y maps pe o ming a equen ial analysis o he segmen a ion.

86 Chap e 5. Gene a ion o densi y maps
Thi d, we also p esen he densi y maps by pe o ming a spa ial analysis o he segmen a ion. The i s
wo maps ( om le o igh ) belong o ge Une KT model, while he wo las maps belong o ge Une KT CS
model:
Ve ical densi y map Ho izon al densi y map Ve ical densi y map Ho izon al densi y map
Figu e 5.33 P001180 densi y maps pe o ming a spa ial analysis o he segmen a ion.
5.3 Densi y maps ob ained in some expe imen s 87
See now he inclina ion o he h eads in each a ea o he pla e, since his alue has been ob ained when
pe o ming he spa ial coun The de ia ion in deg ees map ob ained is p ac ically he same o bo h model,
so we only a ach a igu e ha would be alid o bo h models:
Ve ical angle map Ho izon al angle map
Figu e 5.34 P001180 Angle de ia ion in deg ees wi h ge Une KT /ge Une KT CS.
88 Chap e 5. Gene a ion o densi y maps
Las ly, le ’s see he compa ison o he e ical and ho izon al coun his og ams wi h each o he h ee
me hods:
FT Ho izon al coun ing FT Segmen a ion Ho izon al coun ing Spa ial Ho izon al coun ing
FT Ve ical coun ing FT Segmen a ion Ve ical coun ing Spa ial Ve ical coun ing
Figu e 5.35 P001180 Coun ing his og ams wi h ge Une KT.
FT Ho izon al coun ing FT Segmen a ion Ho izon al coun ing Spa ial Ho izon al coun ing
FT Ve ical coun ing FT Segmen a ion Ve ical coun ing Spa ial Ve ical coun ing
Figu e 5.36 P001180 Coun ing his og ams wi h ge Une KT CS.
The ab ic’s equency analysis wo ks qui e poo ly, as expec ed o he ype o can as i is (see Figu e
5.31). The esul imp o es a lo when applying he equency coun o he segmen a ion, as can be seen in
Figu e 5.32. FT wo ks badly because he h eads in one o he di ec ions a e ba ely isible, only pe cei ed
5.3 Densi y maps ob ained in some expe imen s 89
as small nodules a he c ossing poin s. This is logically sol ed by applying FT o he segmen a ion. Finally,
spa ial coun ing (see Figu e 5.33) u he imp o es he esul , o e ing e y smoo h densi y maps, in which
he pain ing’s inge p in can be pe ec ly pe cei ed. The imp o emen ob ained in he spa ial coun may be
due o he ac ha he segmen a ion some imes p esen s i egula dis ance be ween h eads, a ec ing he
pe o mance o he FT. F om he ho izon al map o he spa ial coun we can deduce ha in he uppe a ea
he e is a kind o seam ac oss he wid h, which has a somewha lowe coun alue (i can be seen in yellow
and g een in he igu e 5.33). This is undoub edly ela ed o he esul s o he il maps, in which we see ha
he e seems o be some al e a ion in ha a ea, since he es o he il maps a e p ac ically neu al. Fo hei
pa , he his og ams show he poo esul ob ained wi h he coun ing based on he FT o he pla e, as well as
he good esul s wi h he o he wo me hods. See now some examples o his pla e:
Example wi h ge Une KT model
Example wi h ge Une KT CS model
Figu e 5.37 P001180 examples.
In he i s pa ch we see ha he me hod based on he FT o he pa ch ails in he e ical coun , ha is
p ecisely whe e he pa e n is no app ecia ed. I ’s pe cep ible ha he e ical h eads a e only seen as a
widening a he c ossing poin s. The me hods based on he segmen a ion do wo k eally well. In he second
pa ch we see ha he e is a se ies o e ical h eads e y close oge he in he cen e o he image, while
he e a e hicke ones in o he a eas o he image. This means ha he dis ance be ween h eads is no e y
homogeneous, so nei he FT o he pa ch and he equency analysis o he segmen a ion wo k well. Spa ial
coun ing does p o ide sa is ac o y esul s in bo h cases. In he densi y maps ob ained o his pla e he e a e
no g ea di e ences be ween hose ob ained wi h he ge Une KT model and hose ob ained wi h he ge Une
KT CS model, al hough i we look a he spa ial coun densi y maps we would say ha he esul ob ained
using he ge Une KT CS model looks somewha be e , especially in he ho izon al densi y map, since he e
seems o be mo e con inui y in he egions wi h mo e in ense ed colo .
96 Chap e 5. Gene a ion o densi y maps
Las ly, le ’s see he compa ison o he e ical and ho izon al coun his og ams wi h each o he h ee
me hods:
FT Ho izon al coun ing FT Segmen a ion Ho izon al coun ing Spa ial Ho izon al coun ing
FT Ve ical coun ing FT Segmen a ion Ve ical coun ing Spa ial Ve ical coun ing
Figu e 5.53 P999 Coun ing his og ams wi h ge Une KT.
FT Ho izon al coun ing FT Segmen a ion Ho izon al coun ing Spa ial Ho izon al coun ing
FT Ve ical coun ing FT Segmen a ion Ve ical coun ing Spa ial Ve ical coun ing
Figu e 5.54 P999 Coun ing his og ams wi h ge Une KT CS.
The can as o his pla e is e y simila o ha o P998, and his can be seen eliably ep esen ed in he
densi y maps. The esul s on he maps a e p ac ically iden ical, wi h he same p oblems and ad an ages as
be o e. The i s me hod s ill p o ides blue a eas whe e i is no able o ge he coun well, while he second

5.3 Densi y maps ob ained in some expe imen s 97
me hod combined wi h he ge Une KT CS model seems o ge he bes esul s by b inging ou he mos
in ense ed in some a eas, al hough spa ial coun ing also gi es e y good esul s. The ho izon al inclina ion
maps does exhibi s some di e ences, since be o e he e was a no able inclina ion o he ho izon al h eads
in some a eas and now he e is no any inclina ion o he h eads in he en i e pla e. In he his og ams, he
bimodal cha ac e seen p e iously appea s again. Finally, le ’s see some examples o speci ic pa ches:
Example wi h ge Une KT model
Example wi h ge Une KT CS model
Figu e 5.55 P999 examples.
In he i s pa ch, all h ee me hods wo k qui e well, which is expec ed since he pa e n is gene ally well
de ined. In he second pa ch, no able di e ences appea in he ho izon al coun . I is due o he p esence o a
hick ho izon al h ead ha b eaks he homogenei y o he pa e n, which means ha only he spa ial coun
wo ks well. Emphasize ha in some pa ches om bo h Mu illo pla es which has a lo o noise, he equency
coun o he pa ch can be use ul o e he spa ial coun , since he FT is able o see he unde lying s uc u es o
he image and ob ain he coun (some hing ha he spa ial coun canno do i he segmen a ion ails due o
noise).
98 Chap e 5. Gene a ion o densi y maps
5.3.6 P001692 Resul s
We p esen he densi y maps ob ained o he P001692 pla e. Some pa ches om his pla e we e used in he
aining se . Le ’s see he densi y maps ob ained by pe o ming he equency analysis o he pla e:
Ve ical densi y map Ho izon al densi y map
Figu e 5.56 P001692 densi y maps pe o ming a equen ial analysis o he pla e.
Nex , le ’s see hose densi y maps when pe o ming he equen ial analysis o he segmen a ion:
Ve ical densi y map Ho izon al densi y map
Figu e 5.57 P001692 densi y maps pe o ming a equen ial analysis o he segmen a ion wi h ge Une KT.
5.3 Densi y maps ob ained in some expe imen s 99
Ve ical densi y map Ho izon al densi y map
Figu e 5.58
P001692 densi y maps pe o ming a equen ial analysis o he segmen a ion wi h ge Une KT
CS.
Thi d, we also p esen he densi y maps by pe o ming a spa ial analysis o he segmen a ion:
Ve ical densi y map Ho izon al densi y map
Figu e 5.59 P001692 densi y maps pe o ming a spa ial analysis o he segmen a ion wi h ge Une KT.
100 Chap e 5. Gene a ion o densi y maps
Ve ical densi y map Ho izon al densi y map
Figu e 5.60 P001692 densi y maps pe o ming a spa ial analysis o he segmen a ion wi h ge Une KT CS.
We can also ep esen he inclina ion o he h eads in each a ea o he pla e, since his alue has been
ob ained when pe o ming he spa ial coun :
Ve ical angle map Ho izon al angle map
Figu e 5.61 P001692 Angle de ia ion in deg ees wi h ge Une KT /ge Une KT CS.
5.3 Densi y maps ob ained in some expe imen s 101
Las ly, le ’s see he compa ison o he e ical and ho izon al coun his og ams wi h each o he h ee
me hods:
FT Ho izon al coun ing FT Segmen a ion Ho izon al coun ing Spa ial Ho izon al coun ing
FT Ve ical coun ing FT Segmen a ion Ve ical coun ing Spa ial Ve ical coun ing
Figu e 5.62 P001692 Coun ing his og ams wi h ge Une KT.
FT Ho izon al coun ing FT Segmen a ion Ho izon al coun ing Spa ial Ho izon al coun ing
FT Ve ical coun ing FT Segmen a ion Ve ical coun ing Spa ial Ve ical coun ing
Figu e 5.63 P001692 Coun ing his og ams wi h ge Une KT CS.
This pla e is pa icula , since i p esen s in some a eas he highes coun s seen so a . In he densi y maps,
i s ands ou ha he applica ion o he FT di ec ly on he pa ches again p oduces in ense blue a eas, ha is,
a eas whe e i does no coun well (see Figu e 5.56). This is mi iga ed in pa by applying he FT on he

102 Chap e 5. Gene a ion o densi y maps
segmen a ion, since we can see how he densi y maps a e much cleane compa ed o he p e ious ones (see
Figu e 5.57). I ’s ue ha he e a e blue a eas, especially on he ho izon al map, ha do no co espond o
e o s bu o coun s o ha densi y. The blue a eas ha we can a ibu e as e o s a e hose ha a e andomly
dis ibu ed h oughou he pla e, no hose ha o m well-de ined egions. The a o emen ioned imp o emen
is e en mo e no iceable when iewing he densi y maps ob ained wi h he spa ial coun , whe e he di e en
a eas wi h di e en coun s can be clea ly app ecia ed (see Figu es 5.59). The cen al a ea o he densi y
maps is s iking, whe e he e seems o be some kind o e ical seam ha uni es wo di e en ab ics. This
pa ly explains he wo o ange and ed a eas ha we see in he cen al pa o he e ical densi y map. When
he seam is he e, he su ounding h eads igh en and come oge he mo e, which causes ha in each squa e
cen ime e analyzed he coun inc eases. On he o he hand, he di e ence in he densi y maps ob ained wi h
each o he U-Ne models is no able on his pla e. The ge Une KT CS model o e s a clea e esul , o e ing
mo e uni o m coun s in p ac ically he en i e pla e. In he il maps we see how he e is a ce ain angle in he
edge a eas, possibly due o he nails. Finally, he his og ams again show ha a o he le when using he i s
me hod, since hose unwan ed blue egions ha appea when using he FT di ec ly on he pa ches causes
hose e y low coun s o be e lec ed in he his og am. The es o he esul s and he his og ams a e he usual
ones, wi h ew di e ences be ween he second and hi d me hods (beyond he esolu ion o he his og ams,
as usual). Remembe ha he e we e some pa ches ex ac ed om his pla e in he aining se , so i was
expec ed ha he densi y maps would be good how i is he case. Le ’s see some examples o his pain ing:
Example wi h ge Une KT model
Example wi h ge Une KT CS model
Figu e 5.64 P001692 examples.
In he i s image we see how all he me hods o e good esul s. I could be expec ed ha he FT o
he pa ch would no o e a good coun due o he p esence o h eads o di e en hicknesses, al hough
su p isingly his has no been he case. In he second image we see ha he spa ial coun is somewha below
he eal esul , which is ob ained by he o he wo ways. In his case he h ead pa e n is e y well de ined
and i was expec ed ha he equency me hods would wo k well.
5.3 Densi y maps ob ained in some expe imen s 103
5.3.7 P001693 Resul s
Nex we p esen he densi y maps ob ained o he P01693 pla e, which has a simila can as o he P001692
and also has some samples in he aining se . Le ’s see he densi y maps ob ained by pe o ming he equency
analysis o he pla e:
Ve ical densi y map Ho izon al densi y map
Figu e 5.65 P001693 densi y maps pe o ming a equen ial analysis o he pla e.
Nex , le ’s see hose densi y maps when pe o ming he equen ial analysis o he segmen a ion:
Ve ical densi y map Ho izon al densi y map
Figu e 5.66 P001693 densi y maps pe o ming a equen ial analysis o he segmen a ion wi h ge Une KT.
104 Chap e 5. Gene a ion o densi y maps
Ve ical densi y map Ho izon al densi y map
Figu e 5.67
P001693 densi y maps pe o ming a equen ial analysis o he segmen a ion wi h ge Une KT
CS.
Thi d, we also p esen he densi y maps by pe o ming a spa ial analysis o he segmen a ion:
Ve ical densi y map Ho izon al densi y map
Figu e 5.68 P001693 densi y maps pe o ming a spa ial analysis o he segmen a ion wi h ge Une KT.
5.3 Densi y maps ob ained in some expe imen s 105
Ve ical densi y map Ho izon al densi y map
Figu e 5.69 P001693 densi y maps pe o ming a spa ial analysis o he segmen a ion wi h ge Une KT CS.
We can also ep esen he inclina ion o he h eads in each a ea o he pla e, since his alue has been
ob ained when pe o ming he spa ial coun :
Ve ical angle map Ho izon al angle map
Figu e 5.70 P001693 Angle de ia ion map wi h ge Une KT /ge Une CS.
112 Chap e 5. Gene a ion o densi y maps
5.3.9 P49435-1 Resul s
Nex we p esen he densi y maps ob ained o he P49435-1 pla e. Some pa ches om his pla e a e in he
aining se . We s a wi h he densi y maps ob ained by pe o ming he equency analysis o he pla e:
Ve ical densi y map Ho izon al densi y map
Figu e 5.83 P49435-1 densi y maps pe o ming a equen ial analysis o he pla e.
Nex , le ’s see hose densi y maps when pe o ming he equen ial analysis o he segmen a ion:
Ve ical densi y map Ho izon al densi y map
Figu e 5.84
P49435-1 densi y maps pe o ming a equen ial analysis o he segmen a ion wi h ge Une KT.

5.3 Densi y maps ob ained in some expe imen s 113
Ve ical densi y map Ho izon al densi y map
Figu e 5.85
P49435-1 densi y maps pe o ming a equen ial analysis o he segmen a ion wi h ge Une KT
CS.
Thi d, we also p esen he densi y maps by pe o ming a spa ial analysis o he segmen a ion:
Ve ical densi y map Ho izon al densi y map
Figu e 5.86 P49435-1 densi y maps pe o ming a spa ial analysis o he segmen a ion wi h ge Une KT.
114 Chap e 5. Gene a ion o densi y maps
Ve ical densi y map Ho izon al densi y map
Figu e 5.87 P49435-1 densi y maps pe o ming a spa ial analysis o he segmen a ion wi h ge Une KT CS.
We can also ep esen he inclina ion o he h eads in each a ea o he pla e, since his alue has been
ob ained when pe o ming he spa ial coun :
Ve ical angle map Ho izon al angle map
Figu e 5.88 P49435-1 Angle es ima ion wi h ge Une KT /ge Une KT CS.
5.3 Densi y maps ob ained in some expe imen s 115
Las ly, le ’s see he compa ison o he e ical and ho izon al coun his og ams wi h each o he h ee
me hods:
FT Ho izon al coun ing FT Segmen a ion Ho izon al coun ing Spa ial Ho izon al coun ing
FT Ve ical coun ing FT Segmen a ion Ve ical coun ing Spa ial Ve ical coun ing
Figu e 5.89 P49435-1 Coun ing his og ams wi h ge Une KT.
FT Ho izon al coun ing FT Segmen a ion Ho izon al coun ing Spa ial Ho izon al coun ing
FT Ve ical coun ing FT Segmen a ion Ve ical coun ing Spa ial Ve ical coun ing
Figu e 5.90 P49435-1 Coun ing his og ams wi h ge Une KT CS.
In he esul s o his pla e we can see an habi ual pa e n. Wi h he i s me hod nume ous spu ious zones
appea due o he p oblems ha he FT some imes has in o de o ob ain a alid coun (see Figu e 5.83).
This beha io is educed in pa by applying equency analysis o he segmen a ion (see Figu es 5.84 and
5.85), and u he educed by applying spa ial coun ing o he segmen a ion (see Figu es 5.86 and 5.87). On
he o he hand, al hough i is ue ha he spa ial coun o e s he cleanes esul s, we can see in he maps
116 Chap e 5. Gene a ion o densi y maps
gene a ed wi h he equency coun o he segmen a ion how i seems ha his me hod be e coun s he a eas
wi h high densi y in he ho izon al densi y map (wi h he ge Une KT CS model is used). F om he his og ams
we can again highligh he ail ha appea s in he his og am o he i s me hod, p oduc o he blue spu ious
a eas men ioned. Le ’s see some examples o his pain ing:
Example wi h ge Une KT model
Example wi h ge Une KT CS model
Figu e 5.91 P49435-1 examples wi h ge Une KT.
In he i s pa ch we can see how he FT o he pa ch o e s an e oneous coun in he ho izon al di ec ion,
since i coun s an ex a h ead, al hough in gene al he esul s wi h he h ee me hods a e simila and accep able.
Recall ha he e a e samples o his pla e in he aining se . In he second pa ch we see how he spa ial
coun is he one ha o e s he co ec esul in he ho izon al di ec ion. In his case, he h ead pa e n is no
comple ely homogeneous, which can lead o e o s in he equency me hods.
5.3 Densi y maps ob ained in some expe imen s 117
5.3.10 P49435-2 Resul s
Nex we p esen he densi y maps ob ained o he P49435-2 pla e, which is so simila espec o he las
analyzed pla e and he e also a e some pa ches om his pla e in he aining se . We s a wi h he densi y
maps ob ained by pe o ming he equency analysis o he pla e:
Ve ical densi y map Ho izon al densi y map
Figu e 5.92 P49435-2 densi y maps pe o ming a equen ial analysis o he pla e.
Nex , le ’s see hose densi y maps when pe o ming he equen ial analysis o he segmen a ion:
Ve ical densi y map Ho izon al densi y map
Figu e 5.93
P49435-2 densi y maps pe o ming a equen ial analysis o he segmen a ion wi h ge Une KT.

118 Chap e 5. Gene a ion o densi y maps
Ve ical densi y map Ho izon al densi y map
Figu e 5.94
P49435-2 densi y maps pe o ming a equen ial analysis o he segmen a ion wi h ge Une KT
CS.
Thi d, we also p esen he densi y maps by pe o ming a spa ial analysis o he segmen a ion:
Ve ical densi y map Ho izon al densi y map
Figu e 5.95 P49435-2 densi y maps pe o ming a spa ial analysis o he segmen a ion wi h ge Une KT.
5.3 Densi y maps ob ained in some expe imen s 119
Ve ical densi y map Ho izon al densi y map
Figu e 5.96 P49435-2 densi y maps pe o ming a spa ial analysis o he segmen a ion wi h ge Une KT CS.
We can also ep esen he inclina ion o he h eads in each a ea o he pla e, since his alue has been
ob ained when pe o ming he spa ial coun :
Ve ical angle map Ho izon al angle map
Figu e 5.97 P49435-2 Angle de ia ion in deg ees wi h ge Une KT /ge Une KT CS.
120 Chap e 5. Gene a ion o densi y maps
Las ly, le ’s see he compa ison o he e ical and ho izon al coun his og ams wi h each o he h ee
me hods:
FT Ho izon al coun ing FT Segmen a ion Ho izon al coun ing Spa ial Ho izon al coun ing
FT Ve ical coun ing FT Segmen a ion Ve ical coun ing Spa ial Ve ical coun ing
Figu e 5.98 P49435-2 Coun ing his og ams wi h ge Une KT.
FT Ho izon al coun ing FT Segmen a ion Ho izon al coun ing Spa ial Ho izon al coun ing
FT Ve ical coun ing FT Segmen a ion Ve ical coun ing Spa ial Ve ical coun ing
Figu e 5.99 P49435-2 Coun ing his og ams wi h ge Une KT CS.
The esul s ob ained o his pla e a e qui e simila o hose ob ained o he p e ious pla e, since bo h a e
e y simila . E e y hing said hen is e i ied he e as well, al hough pe haps he p esence o lowe coun s in
all he densi y maps and his og ams is s iking. Le ’s see some examples o his pain ing:
5.4 Ma ch be ween densi y maps 121
Example wi h ge Une KT model
Example wi h ge Une KT CS model
Figu e 5.100 P49435-2 examples wi h ge Une KT.
In he i s pa ch we see how he h ee me hods wo k well despi e he high le el o image noise. In he
second pa ch i is ap eciable ha equen ial me hods do no wo k well, since he gaps be ween he h eads
a e a iable in size and his makes spa ial coun ing imp o ing he o he wo me hods.
5.4 Ma ch be ween densi y maps
To inish his chap e , le ’s see i he e is a ma ch be ween he densi y maps o he simila pain ings analyzed.
We will use he densi y maps ob ained by spa ial coun ing o he segmen a ion p o ided by he ge Une KT
model. I mus be aken in o accoun ha he coincidences be ween pla es can only occu in he wa p, which
is he one ha p esen s a de e minis ic beha io . I we emembe wha was men ioned in he in oduc ion o
his documen , he wa p h eads ollow a pa e n de e mined by how hey we e placed on he loom and how
hey we e igh ened. The e o e, all pieces o ab ic cu om he same oll will ha e ma ching wa p h eads.
Howe e , his does no happen in he we , since in ha case he pa e n is o ally andom (i can usually be
easily modeled as a Gaussian). Knowing hese de ails allows us o deduce ha he e can only be a ma ch
in he densi y maps in one di ec ion, p ecisely he one ha co esponds o he wa p. Al hough he wa p is
usually associa ed wi h he e ical h eads, i is possible ha when ixing he ab ic o he wood s e che i
has been o a ed, so in ha case he ma ch would occu be ween he ho izon al h eads.
5.4.1 P07906 and P07906
We ha e no ound any combina ion o he densi y maps o hese wo ables ha p o ides he ma ch sough .
128 Chap e 7. Re e ences
[15] Johnson, D. H., Sun, L., Johnson, C. R. & Hend iks, E. (2010). “Ma ching can as wea e pa e ns om
p ocessing X- ay images o mas e pain ings”, IEEE In e na ional Con e ence on Acous ics, Speech and
Signal P ocessing (ICASSP). Dalas ,TX, USA, 19 Ma ch 2010. IEEE, pp. 958,961
[16] Johnson, D. H., Johnson J , C. R. & E dmann, R. G. (2013). “Wea e analysis o pain ings on can as
om adiog aphs”. Signal P ocessing, 93, pp. 527–540
[17] Simois, F. J. & Mu illo-Fuen es, J. J. (2018). “On he powe spec al densi y applied o he analysis o
old can ases”. Signal P ocessing, 143, pp. 253 – 268
[18] Uni e sidad de Se illa (2019). Desa ollan en la ETSI una he amien a pa a el es udio de lienzos en el
P ado. A aliable in: h ps://www.us.es/ac ualidad-de-la-us/desa ollan-en-la-e si-una-he amien a-pa a-el-
es udio-de-lienzos-en-el-p ado [Consul ed 08-19-2022].
[19] Maa en, L. & E dmann, R. G. (2015). “Au oma ic h ead-le el can as analysis: A machine-lea ning
app oach o analyzing he can as o pain ings”. IEEE Signal P ocess. Mag., 32(4), pp. 38-45
[20] Sizyakin, R., Co nelis, B., Meeus, L., Dubois, H., Ma ens, M., Vo onin, V. & Pizu ica, A. (2020).
“C ack de ec ion in pain ings using con olu ional neu al ne wo ks”. IEEE Access, 8, pp. 74535 – 74552
[21] Robe o, J., O ego, D., Da is & B. (2020). “Towa d he au oma ic e ie al and anno a ion o ou side
a images: A p elimina y s a emen ”, AI4HI. Ma seille, 11-16 May 2020. ERLA, pp. 16-22
[22] Wikia (2022). A e del día. A aliable in: h ps://www.wikia .o g/es [Consul ed 08-17-2022].
[23] Nemade, R. Ni su e, A. , Hi e, P. & Mane, S.B. (2017). “De ec ion o o ge y in a pain ings using
machine lea ning”. In e na ional Jou nal o Inno a i e Resea ch in Science, Enginee ing and Technology,
6(5), pp. 8681-8692
[24] Pu, W., Sobe , B., Daly, N., Higgi , C., Daubechies, I. & Rod igues, M., (2020). “A connec ed au o-
encode s based app oach o image sepa a ion wi h side in o ma ion: Wi h applica ions o a in es iga ion”,
IEEE In . Con . on Acous ics, Speech and Signal P ocess. (ICASSP). 4-8 May 2020, Ba celona. IEEE, pp.
2213–2217
[25] Zou, Z., Zhao, P. & Zhao, X.(2021). “Vi ual es o a ion o he colo ed pain ings on wea he ed beams in
he o bidden ci y using mul iple deep lea ning algo i hms”. Ad anced Enginee ing In o ma ics, 50, pp. 1-15
[26] Bona on e, A. (2008). T ans o mada de Fou ie . A aliable in: h ps://upcommons.upc.edu/bi s eam/handle/
2117/191346/ ema2. ans ou ie 29may2009-2742.pd [Consul ed 08-22-2022].
[27] Tyagi, M. (2021). HOG (His og am o O ien ed G adien s): An o e iew. A ailable in:
h ps:// owa dsda ascience.com /hog-his og am-o -o ien ed-g adien s-67ecd887675 [Consul ed 08-22-2022].
[28] MullO e Thing (2021). Wha is an iso opic gaussian?. A aliable in: h ps://mullo e hing.com/wha -
is-an-iso opic-gaussian/ [Consul ed 08-22-2022].
[29] Kaggle (2021). ResNe -18. A aliable in: h ps://www.kaggle.com/da ase s/py o ch/ esne 18 [Consul ed
08-24-2022].
[30] Educa ion Ecosys em (2018). Unde s anding K-means Clus e ing in ML. A aliable in: h ps:// o-
wa dsda ascience.com/ unde s anding-k-means-clus e ing-in-machine-lea ning-6a6e67336aa1 [Consul ed
08-24-2022].
[31] Na8 (2018). Clasi ica con K-NN in Py hon. A aliable in: h ps://www.ap endemachinelea ning.com/
clasi ica -con-k-nea es -neighbo -ejemplo-en-py hon/ [Consul ed 08-24-2022].
[32] Pape s Wi h Code (2017). VGG. A aliable in: h ps://pape swi hcode.com/me hod/ gg [Consul ed
08-24-2022].

129
[33] Pape s wi h code (2021). Exponen ial Linea Uni . A aliable in: h ps://pape swi hcode.com/me hod/elu
[Consul ed 08-24-2022].
[34] Ribe a, J. (1632). Ixion, Museo Nacional del P ado (P1114).
[35] Ribe a, J. (1632). Ticio, Museo Nacional del P ado (P1113).
[36] P e , M. (1630-1644). Two bunches o g apes wi h a ly, Museo Nacional del P ado (P07905).
[37] P e , M. (1630-1644). Two bunches o g apes, Museo Nacional del P ado (P07906).
[38] Rubens, P.P. (1630-1644). Adam and E e, Museo Nacional del P ado (P001692).
[39] Velázquez, D. (1634-1635). P ince Bal asa Ca los on Ho seback, Museo Nacional del P ado (P001180).
[40] Ge on, A. (2019). Hands-on machine lea ning wi h Sciki -Lea n, Ke as and Tenso Flow: concep s,
ools, and echniques o build in elligen sys ems. O’Reilly. (2nd ed.).
[41] C uces, S. (2022). “Resampling echniques o model selec ion and p edic i e e alua ion”. Uni e sidad
de Se illa.
[42] Sama h, A. (2021). How o spli da a in o h ee se s ( ain, alida ion, and es ) And why?. A ali-
able in: h ps:// owa dsda ascience.com/how- o-spli -da a-in o- h ee-se s- ain- alida ion-and- es -and-why-
e50d22d3e54c [Consul ed 08-24-2022].
[43] Do CSV. (2020). Ap ende qué son las edes neu onales. [YouTube]. 12 No embe 2020. A ali-
able in: h ps://www.you ube.com/wa ch? =MRI 2IwFTPglis =PL-Ogd76BhmcB9OjPucsnc2-piEE96jJDQ
[Consul ed 08-26-2022].
[44] A a ind, P. (2020). CNN s. RNN s. ANN – Analyzing 3 Types o Neu al Ne wo ks in Deep Lea ning.
A aliable in: h ps://www.analy ics idhya.com/blog/2020/02/cnn- s- nn- s-mlp-analyzing-3- ypes-o -neu al-
ne wo ks-in-deep-lea ning/ [Consul ed 08-26-2022].
[45] Doshi, S. (2019). Va ious Op imiza ion Algo i hms Fo T aining Neu al Ne wo k. A aliable in:
h ps:// owa dsda ascience.com/op imize s- o - aining-neu al-ne wo k-59450d71ca 6 [Consul ed 08-26-
2022].
[46] Shah, T. (2017). Abou T ain, Valida ion and Tes Se s in ML. A aliable in: h ps:// owa dsda ascience.com
/ ain- alida ion-and- es -se s-72cb40cba9e7 [Consul ed 08-26-2022].
[47] G upo A ico34. (2022). O e i ing. Qué es, causas, consecuencias y cómo soluciona lo. A aliable in:
h ps://p o eccionda os-lopd.com/emp esas/o e i ing/ [Consul ed 08-26-2022].
[48] Minaee, S., Boyko , Y., Po ikli, F., Plaza, A., Keh a na az, N. Deme i Te zopoulos. (2022). “Image
Segmen a ion Using Deep Lea ning: A su ey”. IEEE TRANSACTIONS ON PATTERN ANALYSIS AND
MACHINE INTELLIGENCE, 44(7), pp. 3523-3542
[49] Lamba, H. (2019). Unde s anding seman ic segmen a ion wi h UNET. A aliable in:
h ps:// owa dsda ascience.com /unde s anding-seman ic-segmen a ion-wi h-une -6be4 42d4b47 [Consul ed
08-26-2022]
[50] She s insky, A. (2020). “Fundamen als o Recu en Neu al Ne wo k (RNN) and Long Sho -Te m
Memo y (LSTM) Ne wo k”. Physica D: Nonlinea Phenomena, 404, pp. 1-43
[51] Vaswani, A., Shazee , N., Pa ma , N., Uszko ei , J., Jones, L., Gomez, N., Kaise , L. Polosukhin, I.
(2017). “A en ion is all you need”, NIPS’17: P oceedings o he 31s In e na ional Con e ence on Neu al
In o ma ion P ocessing Sys ems, pp. 6000-6010
[52] Simonyan, K. Zisse man, A. (2014). “Ve y deep con olu ional ne wo ks o la ge-scale image ecogni-
ion”. ICLR 2015, pp. 1409- 1423
130 Chap e 7. Re e ences
[53] Szegedy, C., Liu, W., Jia, Y., Se an , P., Reed, S., Anguelo , D., E han, E., Vanhoucke, V. Rabino ich,
A. (2015), "Going deepe wi h con olu ions”. IEEE Con e ence on Compu e Vision and Pa e n Recogni ion
(CVPR), pp. 1-9
[54] K izhe sky, A., Su ske e I., Hin on, G. (2012). “ImageNe classi ica ion wi h deep con olu ional neu al
ne wo ks”, P oceedings o he 25 h In e na ional Con e ence on Neu al In o ma ion P ocessing Sys ems,
Lake Tahoe, Ne ada, USA - Volume 1, pp. 1097–1105
[55] He, k., Zhang, X., Ren, S. Sun, J. (2016). “Deep Residual Lea ning o Image Recogni ion”, IEEE
Con e ence on Compu e Vision and Pa e n Recogni ion (CVPR). Las Vegas, NV, USA, 27 June 2016. IEEE,
pp. 770-778
[56] Ronnebe ge , O., Fische , P. B ox. (2015). “U-Ne : Con olu ional Ne wo ks o Biomedical Image
Segmen a ion”, Medical Image Compu ing and Compu e -Assis ed In e en ion - MICCAI 2015. Munich,
5-9 Oc obe 2015. Sp inge In e na ional, pp. 241-241
[57] Kolha , S. Jag ap, J. (2021). “Con olu ional neu al ne wo k based encode -decode a chi ec u es o
seman ic segmen a ion o plan s”. Ecological In o ma ics, 64, pp. 1-12
[58] Kolesniko , A., Doso i skiy, A. Weissenbo n, D., Heigold, G., Uszko ei , J., Beye , L., Minde e , M.,
Dehghani, M., Houlsby, N., Gelly, S., Un e hine , T., Zhai, X. (2021). “An Image is Wo h 16x16 Wo ds:
T ans o me s o Image Recogni ion a Scale”. ICLR 2021
[59] Yu, F. Kol un, V. (2016). “MULTI-SCALE CONTEXT AGGREGATION BY DILATED CONVOLU-
TIONS”. ICLR 2016
[60] Ren, S., He, K., Gi shick, R. Sun, J. (2017). “Fas e R-CNN: Towa ds Real-Time Objec De ec ion wi h
Region P oposal Ne wo ks”. In: IEEE T ansac ions on Pa e n Analysis and Machine In elligence. 1 June
2017. IEEE, 39(6), pp. 1137-1149. DOI: 10.1109/TPAMI.2016.2577031.
[61] Good ellow, I., Pouge -Abadie, J., Mi za, M., Xu, B., Wa de-Fa ley, D., Ozai , S., Bengio, Y. (2014).
“Gene a i e ad e sa ial ne s”. In: Ad ances in neu al in o ma ion p ocessing sys ems, pp. 2672–2680
[62] hlamba28 (2019). UNET-TGS. A aliable in: h ps://gi hub.com/hlamba28/UNET-TGS/blob/mas e /
TGS%20UNET.ipynb [Consul ed 08-16-2022].
[63] Tenso low (2022). .ke as.laye s.Con 2DT anspose. A aliable in: h ps://www. enso low.o g /api
docs/py hon/ /ke as/laye s/Con 2DT anspose [Consul ed 08-16-2022].
[64] B ownlee, J. (2018). A Gen le In oduc ion o D opou o Regula izing Deep Neu al Ne wo ks. A aliable
in: h ps://machinelea ningmas e y.com/d opou - o - egula izing-deep-neu al-ne wo ks/ [Consul ed 08-18-
2022].
[65] A i icial In elligence AWS (2021). Wha is he di e ence be ween same con olu ion and ull con olu ion
in e ms o ea u e map size?. A aliable in: h ps://ai.s ackexchange.com/ques ions/27779/wha -is- he-
di e ence-be ween-same-con olu ion-and- ull-con olu ion-in- e ms-o [Consul ed 08-16-2022].
[66] Fe o, C., Mayo ga, C. N. Ga cía, A. (2020). Llenado de se ies de da os de 2014 a 2019 de PM2.5
po medio de una ed neu onal y una eg esión lineal. Thesis. Uni e sidad Se gio A boleda Mad id. DOI:
10.13140/RG.2.2.35092.53126.
[67] Ke as (2020). Callbacks API. A aliable in: h ps://ke as.io/api/callbacks/ [Consul ed 08-17-2022].
[68] Godoi, D. (2018). Unde s anding bina y c oss-en opy / log loss: a isual explana ion. A ali-
able in: h ps:// owa dsda ascience.com/unde s anding-bina y-c oss-en opy-log-loss-a- isual-explana ion-
a3ac6025181a [Consul ed 08-30-2022].
[69] ML Chea shee (2017). Loss Func ion. A aliable in: h ps://ml-chea shee . ead hedocs.io/en/la es /
loss- unc ions.h ml [Consul ed 08-30-2022].
131
[70] Ke as (2022). Accu acy. A aliable in: h ps://ke as.io/api/me ics/accu acy me ics/ [Consul ed 08-30-
2022].
[71] Ke as (2022). Tune hype pa ame e s in you cus om aining loop. A aliable in: h ps://ke as.io/guides/
ke as- une /cus om- une / [Consul ed 08-30-2022].
[72] Wadeka , S. (2021). Hype pa ame e Tuning in Ke as. A aliable in:
h ps://medium.com/swlh/hype pa ame e - uning-in-ke as- enso low-2-wi h-ke as- une - andomsea ch-
hype band-3e212647778 [Consul ed 08-30-2022].
[73] Wol am Ma hwo ld (2022). Sigmoid unc ion. A aliable in:
h ps://ma hwo ld.wol am.com/SigmoidFunc ion.h ml [Consul ed 08-30-2022].
[74] zeka0 (2017). Cus om laye : ainable h eshold. A aliable in: h ps://gi hub.com/ke as- eam/ke as/issues/
6926 [Consul ed 09-01-2022].
[75] Ka he ine, L. (2022). How o Choose a Lea ning Ra e Schedule o Neu al Ne wo ks. A aliable in:
h ps://nep une.ai/blog/how- o-choose-a-lea ning- a e-schedule [Consul ed 09-01-2022].
[76] Vasani, D. (2019). This hing called Weig h Decay. A aliable in: h ps:// owa dsda ascience.com/ his-
hing-called-weigh -decay-a7cd4bc ccab [Consul ed 09-01-2022].
[77] O su, N. (1979). “A Th eshold Selec ion Me hod om G ay-Le el His og am”. IEEE T ansac ions on
Sys em Man Cybe ne ics, 9, pp. 62-66. DOI: h p://dx.doi.o g/10.1109/TSMC.1979.4310076.
[78] OpenCV (2022). Miscellaneous Image T ans o ma ions. A aliable in: h ps://docs.openc .o g/4.x/d7/d1b/
g oup imgp oc misc.h ml-ggaa42a3e6e 26247da787b 34030ed772cad0c5199ae8637a6b195062 ea4789 a9
[Consul ed 09-01-2022].
[79] Massieu, W. (2020). CENTROS DE MASA, DE GRAVEDAD Y CENTROIDES. A aliable in:
h ps://www.ipn.mx/ asse s/ iles/cecy 11/docs/P ac icas/Fisica/Fisica1/p ac ica-7.pd [Consul ed 09-01-2022].
[80] Scipy docs (2022). Scipy ndimage label. A aliable in: h ps://docs.scipy.o g/doc/scipy/ e e ence/
gene a ed/scipy.ndimage.label.h ml [Consul ed 09-01-2022].
[81] Scipy docs (2022). Scipy ndimage measu emen s cen e o mass. A aliable in: h ps://docs.scipy.o g/doc/
scipy-0.14.0/ e e ence/gene a ed/scipy.ndimage.measu emen s.cen e -o -mass.h ml [Consul ed 09-01-2022].
[82] S ackO e low (2018). Ge coo dina es o local maxima in 2D a ay abo e ce ain alue. A aliable
in: h ps://s acko e low.com/ques ions/9111711/ge -coo dina es-o -local-maxima-in-2d-a ay-abo e-ce ain-
alue [Consul ed 09-01-2022].
[83] Scipy docs (2022). Scipy spa ial KDTREE. A aliable in:: h ps://docs.scipy.o g/doc /scipy/ e e ence/-
gene a ed/scipy.spa ial.KDT ee.h ml [Consul ed 09-01-2022].
[84] Mu illo, B. E. (1660-1665). The a ewell o he p odigal son, Museo Nacional del P ado (P998).
[85] Mu illo, B. E. (1660-1665). The dissipa ion o he p odigal son, Museo Nacional del P ado (P999).
[86] Mon es, D. (2018). Diag ama BoxPlo . A aliable in: h ps://www.pgconocimien o.com/diag ama-
boxplo / [Consul ed 09-01-2022].
[87] Na ional Ins i u e o Heal h (2021). ImageJ. A aliable in: h ps://imagej.nih.go /ij/ [Consul ed 08-18-
2022].
[88] Py hon Docs (2022). Mul ip ocessing. A aliable in: h ps://docs.py hon.o g/3/lib a y/mul ip ocessing.h ml
[Consul ed 17-08-2022].
[89] Py hon Docs (2022). HDF5 o Py hon. A aliable in: h ps://docs.h5py.o g/en/s able/ . [Consul ed
08-21-2022].
132 Chap e 7. Re e ences
[90] Pa e , L. (1777). Sel -po ai in he s udio, Museo Nacional del P ado (P007701).
[91] Velázquez, D. (1630). The o ge o Vulcan, Museo Nacional del P ado (P001171).
[92] Rubens, P.P. (1630-1644). The abduc ion o Eu opa, Museo Nacional del P ado (P001693).
[93] Cab e a, M. (1751). P esen a ion o he Vi gin in he Temple, Museo Nacional del P ado (P49435-1).
[94] Cab e a, M. (1751). The Annuncia ion, Museo Nacional del P ado (P49435-2).
Lis o Figu es
1.1 Types o ab ics and ame 3
1.2 Plain wea e - Ta e a [10] 3
1.3 Pa s o an old loom [11] 4
1.4 Pain ing and X- ay pla e o Adan y E a by Rubens 5
1.5 Ve ical densi y map o Adan y E a by Rubens 5
2.1 X- ay o P1114 Ribe a (MNP) [34] 8
2.2 Spec um o a 1cm pa ch om a can as 8
2.3 Scena io whe e FT wo ks well 10
2.4 Scena io whe e FT doesn’ wo k well 10
2.5 PSD and iangle o h ead coun ing [17] 11
2.6 A acne in e ace [18] 12
3.1 X- ay de ail o P001692 Rubens (MNP) [38] 16
3.2 X- ay de ail o P001180 Velázquez (MNP) [39] 16
3.3 Neu on [43] 17
3.4 Ac i a ion unc ion [43] 17
3.5 Feed- o wa d Ne wo k [43] 18
3.6 CNN + Fully-connec ed ANN [43] 19
3.7 Subsampling 2x2 (MaxPool) in CNN [43] 19
3.8 Pe o mance o g adien descen on a su ace ep esen ing he e o [43] 20
3.9 T aining scheme o a ne wo k [43] 22
3.10 A pa ch and i s label 22
3.11 Example o he a ie y p esen in he da ase 23
3.12 Ob aining 4 pa ches om he co ne s o he o iginal image 24
3.13 300x300 pixel image lipped om igh o le 25
3.14 300x300 pixel image lipped op o bo om 25
3.15 Ob aining he wo cen al pa ches ha will be o a ed la e 26
3.16 T ansposed o he h ee 300x300 pixel images 26
3.17 Dis ibu ion o h ead densi ies pe cm in he h ee subse s 27
3.18 Di e ence be ween all he samples ob ained om he same image using he upda ed Da a Augmen a ion 28
3.19 Di e ence be ween all he samples ex ac ed om an image ha ing all o hem o a ed 90º 28
3.20 U-Ne a chi ec u e [49] 30
3.21 Va ia ion o dimensions in a U-Ne [49] 31
3.22 SegNe a chi ec u e [57] 31
3.23 Ac i a ion unc ions used [66] 32
3.24 con 2dblock [62] 33
133

134 Lis o Figu es
3.25
A chi ec u e used wi h
con 2dblocks
modules in blue ho izon al a ows, wi h he numbe o il e s
used,
ni
, indica ed on op. Up and down s eps in ol e hal ing educ ions o sizes downwa ds, and
duplica e hem upwa ds, wi h ze o padding i needed. Upcoming ea u es a e conca ena ed wi h he
ea u es a he same le el in he encode . The size o all ea u e maps is indica ed below hem. A
he ou pu a 1×1con olu ional il e wi h sigmoid unc ion is used 33
3.26 C oss-en opy o log loss [69] 34
3.27 Lea ning cu es o he wo bes aining sessions 35
3.28 Lea ning cu es o he wo bes ainings wi h LR 1e−435
3.29 Segmen a ion o alida ion images: 36
3.30 Lea ning cu e o he bes model aining ge Une 6 wi h LR 1e−337
3.31 Segmen a ion o alida ion images: T aining 1 wi h LR 1e−3ge Une 6 38
3.32 Segmen a ion o alida ion images wi h ge Une KT and ge Une KT CS 41
4.1 Sigmoid ac i a ion unc ion [73] 43
4.2 Example o segmen a ion p o ided by he U-Ne 44
4.3 Tes image, bina ized segmen a ion and ound egions 46
4.4 Tes image and g ayscale segmen a ion 46
4.5 Ou pu o he local maxima il e 46
4.6 O su h esholding 47
4.7 Bina y image whe e he maximum il e poin s coincide wi h hose o he o iginal image 47
4.8 Image wi h he loca ed poin s 47
4.9 Loca ion o poin s using local maxima 48
4.10 G aphical ep esen a ion o he spa ial coun me hod 49
4.11 Box diag am o e o when O su bina iza ion and spa ial coun a e used 52
4.12 Box diag am o e o when Local MaxFil e bina iza ion and spa ial coun a e used 53
4.13 Box diag am o e o when O su bina iza ion and equencial coun a e used 54
4.14 E o in each image using 3 d aining o ge Une KT model 55
4.15 Tes images whe e e o bigge han 8% occu s using ge Une KT model 56
4.16 Valida ion images whe e e o bigge han 12% occu s using ge Une KT model 57
4.17 E o in each image using 3 d aining o ge Une KT Th eshold model 58
4.18 Tes images whe e e o bigge han 8% occu s using ge Une KT CS model 59
4.19 Valida ion images whe e e o bigge han 12% occu s using ge Une KT CS model 60
5.1 Pla e P0998 shown wi h ImageJ. In ed, he egion o in e es 64
5.2 Di ision in windows o pla e P998 by Mu illo 66
5.3 P07905 pla e and example pa ch 70
5.4 P07906 pla e and example pa ch 71
5.5 P001180 pla e and example pa ch 71
5.6 P998 pla e and example pa ch 72
5.7 P999 pla e and example pa ch 72
5.8 P001692 pla e and example pa ch 73
5.9 P001693 pla e and example pa ch 73
5.10 P1114 pla e and example pa ch 74
5.11 P49435-1 pla e and example pa ch 74
5.12 P49435-2 pla e and example pa ch 75
5.13 P07905 densi y maps pe o ming a equen ial analysis o he pla e 76
5.14 P07905 densi y maps pe o ming a equen ial analysis o he segmen a ion wi h ge Une KT 76
5.15 P07905 densi y maps pe o ming a equen ial analysis o he segmen a ion wi h ge Une KT CS 76
5.16 P07905 densi y maps pe o ming a spa ial analysis o he segmen a ion wi h ge Une KT 77
5.17 P07905 densi y maps pe o ming a spa ial analysis o he segmen a ion wi h ge Une KT CS 77
5.18 P07905 Angle de ia ion in deg ees wi h ge Une KT /ge Une CS 77
5.19 P07905 Coun ing his og ams wi h ge Une KT 78
5.20 P07905 Coun ing his og ams wi h ge Une KT CS 78
5.21 P07905 examples 79
5.22 P07906 densi y maps pe o ming a equen ial analysis o he pla e 80
5.23 P07906 densi y maps pe o ming a equen ial analysis o he segmen a ion wi h ge Une KT 80
5.24 P07906 densi y maps pe o ming a equen ial analysis o he segmen a ion wi h ge Une KT CS 81
Lis o Figu es 135
5.25 P07906 densi y maps pe o ming a spa ial analysis o he segmen a ion wi h ge Une KT 81
5.26 P07906 densi y maps pe o ming a spa ial analysis o he segmen a ion wi h ge Une KT CS 81
5.27 P07906 Angle de ia ion in deg ees wi h ge Une KT /ge Une KT CS 82
5.28 P07906 Coun ing his og ams wi h ge Une KT 82
5.29 P07906 Coun ing his og ams wi h ge Une KT CS 83
5.30 P07906 examples 83
5.31 P001180 densi y maps pe o ming a equen ial analysis o he pla e 84
5.32 P001180 densi y maps pe o ming a equen ial analysis o he segmen a ion 85
5.33 P001180 densi y maps pe o ming a spa ial analysis o he segmen a ion 86
5.34 P001180 Angle de ia ion in deg ees wi h ge Une KT /ge Une KT CS 87
5.35 P001180 Coun ing his og ams wi h ge Une KT 88
5.36 P001180 Coun ing his og ams wi h ge Une KT CS 88
5.37 P001180 examples 89
5.38 P998 densi y maps pe o ming a equen ial analysis o he pla e 90
5.39 P998 densi y maps pe o ming a equen ial analysis o he segmen a ion wi h ge Une KT 90
5.40 P998 densi y maps pe o ming a equen ial analysis o he segmen a ion wi h ge Une KT CS 90
5.41 P998 densi y maps pe o ming a spa ial analysis o he segmen a ion wi h ge Une KT 91
5.42 P998 densi y maps pe o ming a spa ial analysis o he segmen a ion wi h ge Une KT CS 91
5.43 P998 Angle de ia ion in deg ees wi h ge Une KT /ge Une KT CS 91
5.44 P998 Coun ing his og ams wi h ge Une KT 92
5.45 P998 Coun ing his og ams wi h ge Une KT CS 92
5.46 P998 examples 93
5.47 P999 densi y maps pe o ming a equen ial analysis o he pla e 94
5.48 P999 densi y maps pe o ming a equen ial analysis o he segmen a ion wi h ge Une KT 94
5.49 P999 densi y maps pe o ming a equen ial analysis o he segmen a ion wi h ge Une KT CS 94
5.50 P999 densi y maps pe o ming a spa ial analysis o he segmen a ion wi h ge Une KT 95
5.51 P999 densi y maps pe o ming a spa ial analysis o he segmen a ion wi h ge Une KT CS 95
5.52 P999 Angle de ia ion in deg ees wi h ge Une KT /ge Une KT CS 95
5.53 P999 Coun ing his og ams wi h ge Une KT 96
5.54 P999 Coun ing his og ams wi h ge Une KT CS 96
5.55 P999 examples 97
5.56 P001692 densi y maps pe o ming a equen ial analysis o he pla e 98
5.57 P001692 densi y maps pe o ming a equen ial analysis o he segmen a ion wi h ge Une KT 98
5.58 P001692 densi y maps pe o ming a equen ial analysis o he segmen a ion wi h ge Une KT CS 99
5.59 P001692 densi y maps pe o ming a spa ial analysis o he segmen a ion wi h ge Une KT 99
5.60 P001692 densi y maps pe o ming a spa ial analysis o he segmen a ion wi h ge Une KT CS 100
5.61 P001692 Angle de ia ion in deg ees wi h ge Une KT /ge Une KT CS 100
5.62 P001692 Coun ing his og ams wi h ge Une KT 101
5.63 P001692 Coun ing his og ams wi h ge Une KT CS 101
5.64 P001692 examples 102
5.65 P001693 densi y maps pe o ming a equen ial analysis o he pla e 103
5.66 P001693 densi y maps pe o ming a equen ial analysis o he segmen a ion wi h ge Une KT 103
5.67 P001693 densi y maps pe o ming a equen ial analysis o he segmen a ion wi h ge Une KT CS 104
5.68 P001693 densi y maps pe o ming a spa ial analysis o he segmen a ion wi h ge Une KT 104
5.69 P001693 densi y maps pe o ming a spa ial analysis o he segmen a ion wi h ge Une KT CS 105
5.70 P001693 Angle de ia ion map wi h ge Une KT /ge Une CS 105
5.71 P001693 Coun ing his og ams wi h ge Une KT 106
5.72 P001693 Coun ing his og ams wi h ge Une KT CS 106
5.73 P001693 examples 107
5.74 P1114 densi y maps pe o ming a equen ial analysis o he pla e 108
5.75 P1114 densi y maps pe o ming a equen ial analysis o he segmen a ion wi h ge Une KT 108
5.76 P1114 densi y maps pe o ming a equen ial analysis o he segmen a ion wi h ge Une KT CS 108
5.77 P1114 densi y maps pe o ming a spa ial analysis o he segmen a ion wi h ge Une KT 109
5.78 P1114 densi y maps pe o ming a spa ial analysis o he segmen a ion wi h ge Une KT CS 109
5.79 P1114 Angle es ima ion wi h ge Une KT /ge Une CS 109
5.80 P1114 Coun ing his og ams wi h ge Une KT 110
5.81 P1114 Coun ing his og ams wi h ge Une KT CS 110
136 Lis o Figu es
5.82 P1114 Examples 111
5.83 P49435-1 densi y maps pe o ming a equen ial analysis o he pla e 112
5.84 P49435-1 densi y maps pe o ming a equen ial analysis o he segmen a ion wi h ge Une KT 112
5.85 P49435-1 densi y maps pe o ming a equen ial analysis o he segmen a ion wi h ge Une KT CS 113
5.86 P49435-1 densi y maps pe o ming a spa ial analysis o he segmen a ion wi h ge Une KT 113
5.87 P49435-1 densi y maps pe o ming a spa ial analysis o he segmen a ion wi h ge Une KT CS 114
5.88 P49435-1 Angle es ima ion wi h ge Une KT /ge Une KT CS 114
5.89 P49435-1 Coun ing his og ams wi h ge Une KT 115
5.90 P49435-1 Coun ing his og ams wi h ge Une KT CS 115
5.91 P49435-1 examples wi h ge Une KT 116
5.92 P49435-2 densi y maps pe o ming a equen ial analysis o he pla e 117
5.93 P49435-2 densi y maps pe o ming a equen ial analysis o he segmen a ion wi h ge Une KT 117
5.94 P49435-2 densi y maps pe o ming a equen ial analysis o he segmen a ion wi h ge Une KT CS 118
5.95 P49435-2 densi y maps pe o ming a spa ial analysis o he segmen a ion wi h ge Une KT 118
5.96 P49435-2 densi y maps pe o ming a spa ial analysis o he segmen a ion wi h ge Une KT CS 119
5.97 P49435-2 Angle de ia ion in deg ees wi h ge Une KT /ge Une KT CS 119
5.98 P49435-2 Coun ing his og ams wi h ge Une KT 120
5.99 P49435-2 Coun ing his og ams wi h ge Une KT CS 120
5.100 P49435-2 examples wi h ge Une KT 121
5.101 P998 and P999 ma ch 122
5.102 P001692 and P001693 e ical ma ch 123
5.103 P49435-1 and P49435-2 e ical ma ch 124
Lis o Tables
3.1 ge Une aining esul s 34
3.2 ge Une aining esul s, LR 1e−435
3.3 ge Une 6 aining esul s 37
3.4 ge Une KT aining esul s 40
3.5 ge Une KT CS aining esul s 40
5.1 Execu ion ime o each e sion o he algo i hm 69
5.2 Execu ion imes o he mul ip ocessing algo i hm on di e en machines 69
137