Sei sulla pagina 1di 8

Clasificacin de clulas en imgenes de microscopia con FPGA y Redes neuronales implementado con Matlab y Simulink

Classification of cells in microscopics images with both FPGA and Neuronal Networks
implemented with Matlab and Simulink.

Introduction:
Introduccin:
El reconocimiento y clasificacin de clulas ha sido una necesidad latente en diferentes mbitos cientficos como la medicina o la
biologa.

Recognition and classifications cells has been an underlying requirement within different
sciences scope such as Medicin or Biology.
Aunque existen diversos algoritmos y herramientas para este fin, actualmente la mayora de las veces se siguen utilizando el
mtodo manual mediante el uso de microscopios.

Although there are a variety of algorithms and tools for this purpose, the manual method
is still been used by means of the use of microscopes.
La principal limitacin, se debe a la alta complejidad de los algoritmos y a los tiempos de respuesta de estos.

The main limitation, is due to the high complex algorithms and the response time of these
ones.
La aceleracin eficiente de estos algoritmos puede generar un nuevo campo para la creacin de nuevas aplicaciones en tiempo
real que permita mejorar las respuestas en temas de reconocimiento y clasificacin.

The speed efficient of these algorithms can generate a new field to create new aplications
in real time which enables to enhance the response of recognition responses and
clasification.
Dispositivos de hardware modernos como las FPGA (Field-Programmable gate arrays) contienen una gran cantidad de recursos
lgicos que permiten la implementacin eficiente de algoritmos enfocados en la ejecucin paralela.

Modern hardware devices such as FPGA (Field-Progammable gate arrays) contein a


huge amount of login resources which let the efficient algorithms focused in pararell
execution.
En este trabajo, se investig e implemento algoritmos para FPGA de extraccin de caractersticas de clulas en imgenes de
microscopia y su posterior clasificacin mediante redes neuronales, utilizando Matlab y Simulink con sus correspondientes
paquetes para desarrollo con FPGAs.

In this research, algorithms extractions from the feature images cells for the FPGA
were looked into, implemented and sortered by means of neuronal cells, so that it would
be developed by using Matlab and Simulik with their corresponding packages
Se estudi el rendimiento y coste del algoritmo, as como la dificultad de su implementacin con la herramienta.

The cost of the algorithm was studied, as well as the difficulty of the implementation with
the tool. To do this, FPGA Altera DE1-SOC and Matlab R2016b was used to their
implementation.
Para ello se utiliz la FPGA Altera DE1-SOC y Matlab R2016b para su implementacin.

State of Art:
Estado del arte:
Existen diversas aproximaciones tanto en software como en hardware para la extraccin de caractersticas en imgenes, sin
embargo, antes de implementar algo es necesario conocer cual se adapta mejor al problema planteado.

There are a few approches as many as there are in the software and hardware in order
to the extraction of features in images, however, before implementing something its
necesary to know which one is most suitable to the formulated problema.
Las caractersticas de una imagen pueden definirse como funciones de una o ms mediciones, la cual describe una propiedad
cuantificable del objeto. Segn R. S. Choras [1], las caractersticas en imgenes pueden ser catalogadas de la siguiente manera:

Characteristics of an image can be defined as functions of more than one measures, one
of this describes a property of the objet cuantify.

Caracterstica Generales: son caractersticas independientes tanto del color, la textura o la forma, esta puede sub catalogarse en
caractersticas a nivel de pixel (Contiene informacin nica del pixel como el color y posicin del pixel), caractersticas a nivel local
(Funciones aplicadas a un segmento de la imagen), caractersticas a nivel global (Funciones aplicadas a la imagen como un todo).

General characteristics are independent as much from the color, texture, or shape. This
one can be underclassified in different features from the level of a pixel. (That conteins
unic information from the pixel and the position), features in a local level. (Functions
applied to a segment of image), global level charateristics (Applied functions to the image
as a whole)

Traits from the specific Domain: they are more complex and conceptual features such as
a human face, or fingerprints.

Caractersticas de Dominio especfico: son caractersticas ms complejas y conceptuales como por ejemplo un rostro humano,
huellas dactilares, etc.

Due to the FPGA limitation developing to the hardware, its decided the implementation
of the algorithmics for the extraction of characteristics both at the level of pixel and local
level. Among the mechanisims at the local level more known to the extractio of features,
it can be mentioned these followings: Invariant moments, gradients traits, densitys
characteristic, dct among others.

Debido a las limitaciones de las FPGA y de desarrollo para hardware, se decide la implementacin de algoritmos para la extraccin
de caractersticas a nivel de pixel o a nivel local. Entre los mecanismos a nivel local ms conocidos para la extraccin de
caractersticas, se pueden mencionar los siguientes: Momentos invariantes, Caractersticas por Gradientes, Caractersticas por
Densidad, DCT, Entre otros.
The study made from A.Suyygh and G.Abandah [2] about the recognition of arabic writing,
the effectiviness of the algorithmics commented before is showed up, shedding the DCT
(Discrete Cosene Tranform) as the better efectiviness as it is in time execution as it
iswithin error prediction.

El estudio realizado por A. Suyyagh and G. Abandah [2] sobre el reconocimiento de escritura arbica, demostro la efectividad de
los algoritmos comentados anteriormente, arrojando el algormito DCT (Discrete cosene Tranform) como el de mejor efectividad
tanto en tiempo de ejecucin como en errores en la prediccin.

With the data shedded for these two comparatives, the decision of implemening the DCT
for extracting the image, is taken. This algorithmic is currently used to compress JPG
files, enable to rebuild a 64 pixel image with only 9 pixel with a fair lossing of cuality, so
that 9 traits per section of an image 8x8 will be taken. Haitim [3] facilitates a efficient
implementation in hardware from the DCT algorithmic in 2 dimensions applied to images.

Con los datos arrojados por esas comparativas se toma la decisin de implementar el algoritmo DCT para extraer las
caractersticas de la imagen. Este algoritmo es actualmente utilizado para realizar las compresiones de los ficheros JPG,
permitiendo reconstruir un rea de una imagen de 64 pixeles son solo 9 pixeles con una prdida de calidad aceptable, por lo que se
tomarn 9 caractersticas por cada seccin de imagen 8x8. Haitim [3] propone una implementacin eficiente en hardware del
algoritmo DCT en 2 dimensiones aplicado a imgenes.

Con respecto al uso de las redes neuronales, se utilizar el ofrecido por defecto por Matlab neuronal network toolbox. Esta
herramienta permite generar redes neuronales introduciendo los datos de entrada he indicado cules sern las diferentes clases
para su clasificacin.

With regard to the used of neuronal networks, it will be used the default offered by Matlab.
This tool lets generate neuronal networks introducing index data pointing which the
different types will be

Metodologa

Methodology:
In this section, a general idea about the methodology carried out, within the developing
is shown, the kind of indexed used images, implementation in Matlab and Simulik. The
following image shows the steps to the progress.

En esta seccin, se presentar una idea general sobre la metodologa llevada a cabo durante el desarrollo, el tipo de imgenes de
entrada utilizadas, implementacin en Matlab y Simulink. La siguiente imagen muestra los pasos realizados para el desarrollo.
Images Algorithmic, Implementation Results
Start analysis. analysis and and readjusted. analysis. END
checkings.
La primera etapa del proyecto consisti en analizar cules son las posibles caractersticas extrables de las imgenes ejemplo,
estas imgenes consisten en muestras de microscopio de clulas. Para mejorar el manejo de las imgenes con Matlab se decide
normalizar el tamao de estas imgenes, reducindolas a imgenes de 640x480 pixeles, en estas imgenes se observan que las
clulas presentan un tamao aproximado de 16x16 pixeles por lo que se toma este tamao como patrn de ejemplo.

The first steps Project was about the analysis of which the possible extracted features
from the example images were, these images consist on cells samples. To improve the
management images with Matlab was decided to normalized the size of this images,
reducing to a images of 640x480 pixels. In these images it is observed that cells are
16x16 pixels so that this size is taken.

Durante la etapa de investigacin se analizaron diferentes estudios para


identificar cules son los algoritmos ms aptos para realizar la extraccin
de caractersticas en imgenes. Una vez obtenido el mejor algoritmo, fue
necesario validar su viabilidad de implementacin en hardware, este
estudio consisti en analizar las diferentes operaciones realizadas en el
algoritmo comprobando su disponibilidad en Matlab R2016 y con el
compilador a HDL (Ejemplo: funciones como Seno, Arco tangente, Races,
Etc.).

A long the research stage a few studies were analysied to identify which were the most
suitables algorithmics to the extraction the characteristics into images. Once the best
algorithmic was obtained, checking the implementation valiability was neccesary.
This studied consisted on analysis the different operations developed in the algorithmic ,
checking its availability within Matlab R2016 and the HDL compelator (Example: Sin
function, tangent, rootsc
En la etapa de implementacin se utilizaron todos los recursos disponibles de Matlab y Simulink para su desarrollo, teniendo a
disposicin los diferentes ToolBox para el manejo de imgenes, as como los correspondientes para el desarrollo en FPGAs. Hay
que mencionar que, aunque Matlab permite realizar el diseo del algoritmo, la compilacin y el despliegue en la placa se realiza a
travs del software propietario de Altera, Quartus II.

Within the implementation stage all the resources availables from Matlab and Simulink
for the developing were used, having the different Tools Box to the images
managements, as well as the corresponding to the FPGAs developings. Its mentioned
that, in spite of the fact that Matlab enables to make the algorithmic design, the
compilation and the unfolded on the plate, is made throughout the owner Altera,
Quantus II software.
In the last stage, the analysis of the obtained results from executions is made as well as
the cost implementation by means of the use of Matlab.
Por ltimo, se realiza el anlisis de los resultados obtenidos de las ejecuciones realizada, as como el coste de implementacin de
los algoritmos mediante el uso de Matlab.

Extraction characteristic Technic:


Tcnica de extraccin de caractersticas

Extraction characteristic Technic:


La principal razn de la eleccin del algoritmo DCT para la extraccin de caractersticas en imgenes es la simplicidad de su
implementacin en hardware y su alta precisin para el posterior reconocimiento. Adicionalmente permite un alto grado de
paralelismo que se traduce en mejores tiempos de ejecucin. Su implementacin en Matlab R2016b se bas en el algoritmo Arai
DCT realizado por Pratiksha R. Kumbhare[4] para una imagen de tamao NxM,

The main reason of the DCT algorithmic choosing to the traits extration in images is the
simplicity within its implementation in hardware and its high acquarancy. Additionally
that lets a high paralelism grade what it is traducted in better executed time. Their
implementation in Matlab R2016 b was base don the Arai DCT algorithmic made by
Prtiksha R. Kumbhare [4] for an NXM image sized.

1 1
2 2 (2 + 1) (2 + 1)
(, ) = () ( ) () ( ) (, )
2 2
=0 =0

1 , =0 1 , =0
() = { 2 () = { 2
1 , 0 1 , 0
Where f(i,j) is the pixel i,j de from the image, and F(u,v) is the DCT u,v coefficient

Figure1. General Formula DCT in to 2D.


en este algoritmo se toma una ventana de 8x8 pixeles que se desplaza por toda la imagen, a esta ventana se le aplica la funcin
indicada en la Fig1. De esta ventana de 8x8 pixeles se obtienen 64 coeficientes de DCT que representan caractersticas de las
cuales solo se consideran la matriz 3x3 de pixeles de la parte superior izquierda de la ventana ya que estos contiene informacin
suficiente para reconstruir la ventana como lo indica el estudio de Ashraf Suyyagh [2].

In this algorithm a screen shot of 8x8 pixels which moves along the whole image is
taken. It is applied to this screen the indicated function shown in Fig 1. From this 8x8
Pixels 64 DCT Coefficients are obtained which depict features from whom the 3x3 pixel
matrix is only considered from the top of the left window since this one has enough
information to make up the window such the Ashraf Suyyagh indicated [2].
DCT algorithm enables to make a Row-Column disassemble, in other words, to apply
DCT formula to pixels rows and subsequently to the columns, which carries to increase
the paralelism grade.
El algoritmo DCT permite realizar una descomposicin de fila-Columna, es decir aplicar la formula DCT a filas de pixeles y
posteriormente a las columnas[5], esto permite aumentar el grado de paralelismo.

Implementacin en Matlab
El desarrollo se realiz con Matlab R2016b y Simulink utilizando principalmente los mdulos HDL Coder y HDL Visual Toolbox,
para la compilacin del cdigo y el despliegue en la FPGA se utiliz Quartus Prime II standard Edition v16. El software se instal en
un sistema operativo Windows 10, con un procesador Intel Core i7 4700HQ a 2.4Ghz, con 16gb RAM DDR3 a 2133Mhz.

En cuanto a la FPGA se utiliz la plaza Altera DE1-Soc a una velocidad de reloj 50Mhz con las siguientes caractersticas[6]:

Procesador Cyclone V SoC 5CSEMA5F31C6

Puertas lgicas Programables 85000

Memoria embebida 4,450 Kbits

SDRAM Para FPGA 64MB (32Mx16)

Para su implementacin y ejecucin se utiliz el modo FPGA in-the-loop. Este modo establece una conexin de ida y vuelta de los
datos desde el Host (El PC conectado a la placa) y la FPGA permitiendo ejecutar en tiempo real el algoritmo programado.

El siguiente diagrama muestra el flujo general de datos del proyecto (Fig2):

Fig 2. Diagrama de flujo de ejecucin

The whole design was implemented directly by using Simulink, by means of blocks of
HDL Coder toolbox and HDL visin toolbox. The tool enables to generate designs and
execute them in the faster way, yet, a negative aspect it is that does not give the user
the mistakes that are made so far to the compilation by the external tool such as
Quantus II.
Todo el diseo fue implementado directamente en Simulink, utilizando bloques del HDL Coder toolbox y visin HDL toolbox. La
herramienta permite generar diseos y ejecutarlos de manera rpida, sin embargo, un aspecto negativo es que
no indica al usuario los errores de diseo que se pueden estar cometiendo hasta el momento de compilacin por herramientas
externas como Quartus II.

Once the design was generated, the execution of Fixed Point Toolbox was neccesary to
run, to make the type approval used within the designed, since FPGA can not operate
with different types of data, such as Double o flopping point. Due to this a transformation
to a fixed point was neccesary. This transformation involves a loss of precision, so that it
will be analysed to what extend of precision it is necessary to indicate to the type of the
point of the flotting point without lossing efficience within the pattern recognition. The
analysis results will be shown in the head line of analysis results.

Una vez generado el diseo, fue necesario ejecutar una herramienta denominada Fixed Point Toolbox, para homologar los tipos de
datos utilizados en el diseo, ya que la FPGA no puede operar con tipos de datos como Double, o punto flotante. Debido a esto fue
necesario realizar una transformacin a Punto Fijo (Fixed Point). Esta transformacin a Punto fijo incurre en una prdida de precisin,
por lo que se analizar hasta qu grado de precisin es necesario indicar para el tipo de dato de Punto Flotante sin perder eficacia
en el reconocimiento de patrones. Los resultados de este anlisis se mostrarn en el apartado de anlisis de resultados.

Clasificador Neuronal:

In order to create the neuronal network for its sortering; the system was previously
feeded to obtain the images characteristics , and they are therefor labeled in data which
are features which subsequently are the traits which corresponds to a certain types of
cells. For each 640x480 image of a total of 4661 samples of 36 features to be classified
since a image of 16x16 pixel is taken as a pattern overlapping grups of patterns.
Para la creacin de la red neural para clasificacin se aliment previamente el sistema para obtener las caractersticas de las imgenes de ejemplo, posteriormente se
etiquetan en los datos cuales son las caractersticas que corresponden a qu clase de clulas. Por cada Imagen de 640x480 se generan un total de 4661 muestras de 36
caractersticas para ser clasificadas ya que se toma por patrn una imagen de 16x16 pixeles sobreponiendo grupos de patrones.

The neural toolbox network is run after obtaining the characteristics samples, which
enables to create the automatic of the neuronal net, however, this tool does not let modify
aditional designed parameters, only the amount of the hidden nodes within the net. The
default parameters were used a long the creation by using the 70% for the samples for
trying, 15% for checking and 15 % for sampling. The generated net has 36 entry
parameters corresponding to the 36 sample per feature and 3 exit parameter within the
exit layer, which indicates 2 types of cells, one of this represents an empty space of the
image.

Posterior a la obtencin de las muestras de las caractersticas se ejecuta el neural network toolbox de Matlab, esta permite la
creacin automtica de la red neuronal, sin embargo, la herramienta no permite modificar parmetros adicionales sobre el diseo
solo la cantidad de nodos ocultos de la red. Se utilizaron los parmetros por defecto durante la creacin utilizando el 70% de las
muestras para entrenamiento, 15% para validacin y 15% para pruebas. La red generada tiene 36 parmetros de entrada
correspondiente a las 36 caractersticas por muestra y 3 parmetros de salida en la capa de salida, que indican 2 tipos de clulas y
una que representa espacio vaco de la imagen.

For subsequent trials, new neuronal nets are generated again modyfing the number of
hidden nodes of the net, to check whats the optimal number of nodes. The results of
this hidden nodes changes would be observed in the analysis result section.
Para posteriores pruebas se vuelven a generar nuevas redes neuronales variando el nmero de nodos ocultos de la red para
validar cual es el numero ptimo de nodos. Los resultados de estas variaciones de nodos ocultos se podrn observar en el
apartado de anlisis de resultados

Analysis results. Anlisis de resultados

<Por terminar>

References. Referencias

[1] R. S. Choras, Image feature extraction techniques and their applications for CBIR and biometrics
systems, Int. J. Biol. Biomed. Eng., vol. 1, no. 1, pp. 616, 2007.
[2] A. Suyyagh and G. Abandah, FPGA Parallel Recognition Engine for Handwritten Arabic Words, J.
Signal Process. Syst., vol. 78, no. 2, pp. 163170, 2013.
[3] A. Hatim, S. Belkouch, T. Sadiki, and M. MRabet Hassani, Efficient hardware architecture for
direct 2D DCT computation and its FPGA implementation, 2013 25th Int. Conf. Microelectron.
ICM 2013, no. December 2013, 2013.
[4] P. R. Kumbhare and U. M. Gokhale, Design and Implementation of 2D-DCT by Using Arai
Algorithm for Image Compression, vol. 16, no. 5, pp. 18, 2015.
[5] T. S. Pawar, R. G. Sawant, P. S. Bothe, and Sh. A. Chopade, FPGA Implementation of Forward 2D-
DCT and Inverse 2D-DCT Based On Row-Column Decomposition Method, Int. J. Innov. Res.
Comput. Commun. Eng., vol. 3, no. 10, pp. 1013110138, 2015.
[6] Altera, DE1-SoC Board. [Online]. Available: http://www.terasic.com.tw/cgi-
bin/page/archive.pl?Language=English&No=836.

Potrebbero piacerti anche