Click here to Skip to main content
15,886,362 members
Articles / Artificial Intelligence / Neural Networks

Multiple convolution neural networks approach for online handwriting recognition

Rate me:
Please Sign up or sign in to vote.
4.95/5 (37 votes)
9 Apr 2013CPOL8 min read 76K   25.1K   74  
The research focuses on the presentation of word recognition technique for an online handwriting recognition system which uses multiple component neural networks (MCNN) as the exchangeable parts of the classifier.
using System;
using System.Collections.Generic;
using System.Linq;

namespace UPImage.FileFormat
{
    /// <summary>
    /// ///
    /// </summary>
    public class UPCOORD
    {
        /* coord                                                                  */
        /* from UNIPEN.DEF................                                        */
        /* X, Y, T, P, Z, B, RHO, THETA, PHI, including at least X and Y.         */
        public int NrOfCoords;
        public List<String> Coords;
        public int cur_level;
        public int has_z; /* -1=no, > -1=yes, indicating position */
        public int has_p; /* -1=no, > -1=yes, indicating position */
        public int has_t; /* -1=no, > -1=yes, indicating position */
        public int has_b; /* -1=no, > -1=yes, indicating position */
        public int has_rho; /* -1=no, > -1=yes, indicating position */
        public int has_theta; /* -1=no, > -1=yes, indicating position */
        public int has_phi; /* -1=no, > -1=yes, indicating position */
        public UPCOORD()
        {
            NrOfCoords = 0;
            Coords = new List<string>();
            cur_level = 0;
            has_b = -1;
            has_p = -1;
            has_phi = -1;
            has_rho = -1;
            has_t = -1;
            has_theta = -1;
            has_z = -1;
        }
    };
    public class UPHIERACHY
    {
        public int nrOfHierachies;
        public List<String> hieachies;
        public UPHIERACHY()
        {
            nrOfHierachies = 0;
            hieachies = new List<string>();
        }
    };
    //
    public class UPMandatoryDeclarations
    {
        protected UPHIERACHY hierachy;
        protected UPCOORD coord;
        public String m_version;
        public String m_datasource;
        public String m_dataID;
        public UPCOORD m_coord
        {
            get
            {
                return coord;
            }
        }
        public UPHIERACHY m_hierachy
        {
            get
            {
                return hierachy;
            }
        }
        public UPMandatoryDeclarations()
        {
            coord = new UPCOORD();
            hierachy = new UPHIERACHY();
        }
        /// <summary>
        /// GetMandatoryDeclarations 
        /// </summary>
        /// <param name="kw"></param>
        protected void SetMandatoryDeclarations(UPKEYWORD kw)
        {
            switch (kw.keyName)
            {
                case ".VERSION":
                    //manDec.version = kw;
                    break;
                case ".DATA_SOURCE":
                    //manDec.datasource = kw;
                    break;
                case ".DATA_ID":
                    //manDec.dataID = kw;
                    break;
                case ".COORD":
                    SetCoord(kw);
                    break;
                case ".HIERARCHY":
                    SetHierachies(kw);
                    break;
            }
        }
        //private functions
        private void SetHierachies(UPKEYWORD kw)
        {
            //get hierachies
            if (kw.keyName == UPImage.Common.UpCommonLib.keyHierarchy)
            {
                foreach (var s in kw.content_list)
                {
                    String tempSt;
                    if (UPImage.Common.UpCommonLib.SubStringSearch(null, s, UPImage.Common.UpCommonLib.keyHierarchy))
                    {
                        tempSt = s.Substring(s.IndexOf(" ")).Trim();
                    }
                    else
                    {
                        tempSt = s.Trim();
                    }
                    //check parameters
                    if (!String.IsNullOrWhiteSpace(tempSt))
                    {
                        UPImage.Common.UpCommonLib.GetWordsFromString(null, tempSt, out hierachy.hieachies);
                    }
                }
                hierachy.nrOfHierachies = hierachy.hieachies.Count;
            }
        }
        private void SetCoord(UPKEYWORD kw)
        {
            //Get coords
            if (kw.keyName == UPImage.Common.UpCommonLib.keyCoord)
            {

                foreach (var s in kw.content_list)
                {
                    String tempSt;
                    if (UPImage.Common.UpCommonLib.SubStringSearch(null, s, UPImage.Common.UpCommonLib.keyCoord))
                    {
                        tempSt = s.Substring(s.IndexOf(" ")).Trim();
                    }
                    else
                    {
                        tempSt = s.Trim();
                    }
                    //check parameters
                    if (!String.IsNullOrWhiteSpace(tempSt))
                    {
                        UPImage.Common.UpCommonLib.GetWordsFromString(null, tempSt, out coord.Coords);
                    }
                }
            }
            //
            coord.NrOfCoords = coord.Coords.Count;
            if (coord.NrOfCoords > 2)
            {
                foreach (var st in coord.Coords)
                {
                    switch (st)
                    {
                        case "T":
                            coord.has_t = 1;
                            break;
                        case "P":
                            coord.has_p = 1;
                            break;
                        case "Z":
                            coord.has_z = 1;
                            break;
                        case "B":
                            coord.has_b = 1;
                            break;
                        case "RHO":
                            coord.has_rho = 1;
                            break;
                        case "THETA":
                            coord.has_theta = 1;
                            break;
                        case "PHI":
                            coord.has_phi = 1;
                            break;
                    }
                }
            }
        }
    }
}

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


Written By
Vietnam Maritime University
Vietnam Vietnam
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.

Comments and Discussions