October 13, 2005 0 MATLAB Fuzzy Logic Toolbox Intelligent Control.
Tutorial: Fuzzy Computer Vision Toolbox - C.S. Chancs-chan.com/doc/FCVT2017.pdf · Tutorial: Fuzzy...
Transcript of Tutorial: Fuzzy Computer Vision Toolbox - C.S. Chancs-chan.com/doc/FCVT2017.pdf · Tutorial: Fuzzy...
![Page 1: Tutorial: Fuzzy Computer Vision Toolbox - C.S. Chancs-chan.com/doc/FCVT2017.pdf · Tutorial: Fuzzy Computer Vision Toolbox FUZZ 2017 Chee Seng Chan cs.chan@um.edu.my Abstract This](https://reader030.fdocuments.net/reader030/viewer/2022040423/5e19a624f5259b7aab712a1f/html5/thumbnails/1.jpg)
Tutorial:FuzzyComputerVisionToolboxFUZZ2017
AbstractThisisahandbookforbeginnertounderstandthegeneralpipelineandalgorithmsincomputervision.Aguidelinetobuildyourself thefirst computervisionapplicationwith computer vision and Fuzzy toolbox. The toolbox can be downloaded at:https://github.com/cs-chan/FuzzyComputerVision
![Page 2: Tutorial: Fuzzy Computer Vision Toolbox - C.S. Chancs-chan.com/doc/FCVT2017.pdf · Tutorial: Fuzzy Computer Vision Toolbox FUZZ 2017 Chee Seng Chan cs.chan@um.edu.my Abstract This](https://reader030.fdocuments.net/reader030/viewer/2022040423/5e19a624f5259b7aab712a1f/html5/thumbnails/2.jpg)
FUZZYCOMPUTERVISIONTOOLBOX FUZZ2017
pg.1
TableofContentsPre-requisite..........................................................................................................................................2
Introduction...........................................................................................................................................3
SectionA:ImageAcquisition.................................................................................................................5
(1)ReadSource..................................................................................................................................5
SectionB:ImagePre-Processing...........................................................................................................6
(1):Imageresize.................................................................................................................................6
(2):Imageconversion........................................................................................................................6
(3):ImageMorphologicalOperations...............................................................................................7
(4):ImageFiltering.............................................................................................................................9
SectionC:FeatureExtraction..............................................................................................................11
(1):VisualFeatures..........................................................................................................................11
(a):ColorDetector........................................................................................................................11
(b):EdgeDetector........................................................................................................................12
(c):Cornerdetector......................................................................................................................13
(2):HolisticImageFeatures.............................................................................................................13
(a):LocalBinaryPatterndetector................................................................................................13
(3):LocalImageFeatures.................................................................................................................14
(a):Keypointdetector..................................................................................................................14
(4):FeatureRepresentationusingBagofFeature(Forkeypointsdetector).................................16
SectionD:ImageClassification...........................................................................................................18
(1)CrispClassification.....................................................................................................................19
(a)SVMClassification...................................................................................................................19
(b)ImageClassificationwithCrispApproach...............................................................................19
(2)FuzzyClassification(FQRC)........................................................................................................20
(a)Fuzzymembershipgeneration(Datadriven)..........................................................................21
(b)Inference.................................................................................................................................25
(c)ClassificationusingFQRC.........................................................................................................28
(d)ImageClassificationwithFuzzyApproach..............................................................................30
References:..........................................................................................................................................33
![Page 3: Tutorial: Fuzzy Computer Vision Toolbox - C.S. Chancs-chan.com/doc/FCVT2017.pdf · Tutorial: Fuzzy Computer Vision Toolbox FUZZ 2017 Chee Seng Chan cs.chan@um.edu.my Abstract This](https://reader030.fdocuments.net/reader030/viewer/2022040423/5e19a624f5259b7aab712a1f/html5/thumbnails/3.jpg)
FUZZYCOMPUTERVISIONTOOLBOX FUZZ2017
pg.2
Pre-requisiteTherearea fewprerequisitesbeforeyou start thispractical,pleaseensureyouhave installed thefollowingtoolboxesorlibrariesinyourcomputer.Youmayfollowthestepsbelowforinstallation:
1. InstallPython(RecommendAnacondaPython2.7version)i. Downloadfrom:https://www.continuum.io/downloads
2. Installopencvlibrary(version2.4.x.x)
i. Downloadopencvlibraryfrom:http://opencv.org/releases.htmlii. Double-clicktoextracttheopencv.iii. Goto“opencv/build/python/2.7/x64folder.”iv. Copycv2.pydtoyourpythondirectoryinthe“lib/site-packages”.
3. Installscikit-imagepackage.
i. Openanacondapromptii. Type“pipinstallscikit-image”iii. Webreference:http://scikit-image.org/
4. Installscikit-learnpackage.
i. Openanacondapromptii. Type“pipinstallscikit-learn”iii. Webreference:http://scikit-learn.org/stable/
![Page 4: Tutorial: Fuzzy Computer Vision Toolbox - C.S. Chancs-chan.com/doc/FCVT2017.pdf · Tutorial: Fuzzy Computer Vision Toolbox FUZZ 2017 Chee Seng Chan cs.chan@um.edu.my Abstract This](https://reader030.fdocuments.net/reader030/viewer/2022040423/5e19a624f5259b7aab712a1f/html5/thumbnails/4.jpg)
FUZZYCOMPUTERVISIONTOOLBOX FUZZ2017
pg.3
IntroductionComputervision isanarea incomputer science thatendowthecapability toextract,analyse,andunderstand a single image or sequence of images to a computer. It involves the development oftheoriesandalgorithmstotransformvisualimagesintodescriptor(s)whichisusefulforvisualcontextunderstanding, recognition task, and decision making. This is an emerging domain due to vastspectrumofapplications,forexamples,sceneunderstanding,objectrecognition,videotracking,eventdetection,andmanyothers.Toachievethis,itisimportanttounderstandthegeneralpipelineofacomputervisionalgorithmasillustratedinFigure1andthispipelineisusedthroughoutthistutorial.
Figure1:Generalpipelineofcomputervisionalgorithm
Inthispractical,theparticipantwillbe instructedonhowtoperformeachofthestepsmentionedabovewithsupportedbyafewnotablepythonlibraries.Inconjunction,anewtoolboxnamedFuzzyQualitativeRankClassifier(FQRC)willbeintroducedforFuzzyClassification.FQRC[Limet.al.,2014]isproposedtoovercomethelimitationsofCrispclassificationandordinaryFuzzyInferenceSystem(FIS)incomputervisiontask.BothCrispandFuzzytechniqueswillbeintroducedinthetutorialwithanapplicationonimageclassification.Thetopicsincludedinthetutorialareasfollows:
A. Image/VideoAcquisitiona. ReadSource
B. ImagePreprocessinga. Resizeimageb. Imageconversionc. Morphologicaloperationd. Imagefiltering
C. FeatureExtractiona. Colordetectionb. Edgedetectionc. Cornerdetectiond. KeypointDetectione. LBPf. FeatureRepresentation
D. ImageClassificationa. CrispClassificationb. FuzzyClassification
Pleasenotethatthecomputervisionfunctionsusedinthistoolboxisbuiltontopoftheexistingwell-known libraries inPythonwhichareOpencv, scikit-image,and scikit-learn libraryexcept theFQRCtoolbox.Forsimplicity,thenecessaryfunctionsarepackagedinamainpythonlibrarynamelyFCVT.TheoverviewofourtoolboxisillustratedinFigure.1.
Image/VideoAcquisition
Imagepreprocessing
FeatureExtraction
Classification/Interpretation
![Page 5: Tutorial: Fuzzy Computer Vision Toolbox - C.S. Chancs-chan.com/doc/FCVT2017.pdf · Tutorial: Fuzzy Computer Vision Toolbox FUZZ 2017 Chee Seng Chan cs.chan@um.edu.my Abstract This](https://reader030.fdocuments.net/reader030/viewer/2022040423/5e19a624f5259b7aab712a1f/html5/thumbnails/5.jpg)
FUZZYCOMPUTERVISIONTOOLBOX FUZZ2017
pg.4
Figure1:OverviewofFCVT
UsercanimportFCVTtoaccessallthefunctionsinthetoolboxandeachofthemwillbediscussedinthistutorial.
import FCVT as fcvt
Pythonfileisprovided:FQRC.py
Sampleimagesandthetrainingandtestingdatasetusedinthistutorialareprovided.
Pythonfileisprovided:FCVT.py
Examplesusedinthistutorialareprovided:Main.py
Installationguideisprovided
![Page 6: Tutorial: Fuzzy Computer Vision Toolbox - C.S. Chancs-chan.com/doc/FCVT2017.pdf · Tutorial: Fuzzy Computer Vision Toolbox FUZZ 2017 Chee Seng Chan cs.chan@um.edu.my Abstract This](https://reader030.fdocuments.net/reader030/viewer/2022040423/5e19a624f5259b7aab712a1f/html5/thumbnails/6.jpg)
FUZZYCOMPUTERVISIONTOOLBOX FUZZ2017
pg.5
SectionA:ImageAcquisition(1)ReadSourceForacomputervisionapplication,theprocessbeginwithacquiringimageorvideoastheinputforfurtherprocessing.ByusingFCVT,thisstepcanbedonebycallingthe“IA_readSource”functionwiththedirectoryisprovidedinfullormerelyfilename(ifthefileisinthelocalfolder).Theusercanindicate“display =True”tovisualizetheimage.
IA_readSource( sourceDir, display ) Sample Code: sourceDir = 'Lenna.png' image = fcvt.IA_readSource(sourceDir, display=True)
Output:
![Page 7: Tutorial: Fuzzy Computer Vision Toolbox - C.S. Chancs-chan.com/doc/FCVT2017.pdf · Tutorial: Fuzzy Computer Vision Toolbox FUZZ 2017 Chee Seng Chan cs.chan@um.edu.my Abstract This](https://reader030.fdocuments.net/reader030/viewer/2022040423/5e19a624f5259b7aab712a1f/html5/thumbnails/7.jpg)
FUZZYCOMPUTERVISIONTOOLBOX FUZZ2017
pg.6
SectionB:ImagePre-Processing(1):ImageresizeAnimagecanberesizedwiththe“IP_resize”functionwhere“sx”and“sy”indicatethescalethattheimagetoberesized(Example:0.5meanstodownsizetheimageinto½oftheoriginalsize).
IP_resize(image, sx, sy, display) Sample Code: imageResize = fcvt.IP_resize(image, 0.5, 0.5, True)
Output:
(Original Image) (Resized Image)
(2):ImageconversionTherearesometimesanimageispreferabletobeconvertedintodifferentcolorspacetosimplifyorto support the later processes such as feature extraction.With FCVT, user can easily convert tograyscaleorbinaryimagefromcolorimagewiththefollowingfunctions.
*Note:ThethresholdforthebinaryconversionisusingOtsumethod[Otsu,1979].
IP_convertGray(image, display) IP_convertBinary(image, display) Sample Code: imageGray = fcvt.IP_convertGray(image, True) imageBinary = fcvt.IP_convertBinary(image, True)
![Page 8: Tutorial: Fuzzy Computer Vision Toolbox - C.S. Chancs-chan.com/doc/FCVT2017.pdf · Tutorial: Fuzzy Computer Vision Toolbox FUZZ 2017 Chee Seng Chan cs.chan@um.edu.my Abstract This](https://reader030.fdocuments.net/reader030/viewer/2022040423/5e19a624f5259b7aab712a1f/html5/thumbnails/8.jpg)
FUZZYCOMPUTERVISIONTOOLBOX FUZZ2017
pg.7
Output:
(3):ImageMorphologicalOperationsImagesmaycontainnumerous imperfections. Inparticular, thebinary regionsproducedbysimplethresholdingaredistortedbynoiseandtexture(example,gapsbetweenthepixels).Morphologicalimageprocessingpursuesthegoalsofremovingtheseimperfectionsbyaccountingfortheformandstructureoftheimage.Morphologicaloperatorsoftentakeabinaryimageandastructuringelementasinputandcombinethemusingasetoperator(intersection,union,inclusion,complement).Theyprocessobjects in the input imagebasedoncharacteristicsof itsshape,whichareencoded inthestructuringelement.Therearefourcommontypesofmorphologicaloperationswhichare;erosion,dilation,openingandclosing.
Figure2:Dilationwithstructuringelementas(b)
Figure3:Erosionwithstructuringelementas(b)
![Page 9: Tutorial: Fuzzy Computer Vision Toolbox - C.S. Chancs-chan.com/doc/FCVT2017.pdf · Tutorial: Fuzzy Computer Vision Toolbox FUZZ 2017 Chee Seng Chan cs.chan@um.edu.my Abstract This](https://reader030.fdocuments.net/reader030/viewer/2022040423/5e19a624f5259b7aab712a1f/html5/thumbnails/9.jpg)
FUZZYCOMPUTERVISIONTOOLBOX FUZZ2017
pg.8
FollowinglinesperformmorphologicaloperationwithaDigitimage.
*Note:Themethodargumentcanbethefollowings:
i. erosionii. dilationiii. open(Erodethendilate)iv. closing(Dilatethenerode)
Andthekernelisthesizeofkernelspecifyinpythontuple,example,(3,3)for3x3kernel.
IP_imageMorph(image, method, kernelSize, display) Sample Code: imageDigit = fcvt.IA_readSource('Digit3.png', True) imageMorph = fcvt.IP_imageMorph(imageDigit, 'erosion', (3,3), True) imageMorph = fcvt.IP_imageMorph(imageDigit, 'dilation', (5,5), True) imageMorph = fcvt.IP_imageMorph(imageDigit, 'opening', (3,3), True) imageMorph = fcvt.IP_imageMorph(imageDigit, 'closing', (5,5), True)
Output:
(Original Image)
(Erosion – The noise are eliminated) (Dilation – The gap are connected)
![Page 10: Tutorial: Fuzzy Computer Vision Toolbox - C.S. Chancs-chan.com/doc/FCVT2017.pdf · Tutorial: Fuzzy Computer Vision Toolbox FUZZ 2017 Chee Seng Chan cs.chan@um.edu.my Abstract This](https://reader030.fdocuments.net/reader030/viewer/2022040423/5e19a624f5259b7aab712a1f/html5/thumbnails/10.jpg)
FUZZYCOMPUTERVISIONTOOLBOX FUZZ2017
pg.9
(Open-Erode then dilate) (Close-Dilate then erode)
(4):ImageFilteringImagenoiseisrandom(notpresentintheobjectimage)variationofbrightnessorcolorinformationin images. It is an unwanted signal that could be an obstacle in the later processes (e.g. featureextraction)and itmightaffect theoverall systemperformance.Thus, it is important tohavenoiseremovalintheimagepreprocessingstep.Followinglinesdemonstratesnoiseremovalbyusingthreedifferentfilters(Average,Gaussian,andMedian)oncameramanimagewithsaltandpeppernoise.
*Note:Themethodargumentcanbethefollowings:
i. averageii. Gaussianiii. median
Andthekernelisthesizeofkernelspecifyintuple,example,(3,3)for3x3kernel.
IP_imageFilt(image, method, kernel, display) Sample Code: imageCameraman = fcvt.IA_readSource('cameraman_noise.jpg', True) imageFiltered = fcvt.IP_imageFilt(imageCameraman, 'average', (10,10), True) imageFiltered = fcvt.IP_imageFilt(imageCameraman, 'gaussian', (5,5), True) imageFiltered = fcvt.IP_imageFilt(imageCameraman, 'median', (3,3), True)
![Page 11: Tutorial: Fuzzy Computer Vision Toolbox - C.S. Chancs-chan.com/doc/FCVT2017.pdf · Tutorial: Fuzzy Computer Vision Toolbox FUZZ 2017 Chee Seng Chan cs.chan@um.edu.my Abstract This](https://reader030.fdocuments.net/reader030/viewer/2022040423/5e19a624f5259b7aab712a1f/html5/thumbnails/11.jpg)
FUZZYCOMPUTERVISIONTOOLBOX FUZZ2017
pg.10
Output:
(OriginalimagewithSaltandpeppernoise)(ResultfromAveragefilter)
(ResultfromGaussianfilter) (Resultfrommedianfilter)
![Page 12: Tutorial: Fuzzy Computer Vision Toolbox - C.S. Chancs-chan.com/doc/FCVT2017.pdf · Tutorial: Fuzzy Computer Vision Toolbox FUZZ 2017 Chee Seng Chan cs.chan@um.edu.my Abstract This](https://reader030.fdocuments.net/reader030/viewer/2022040423/5e19a624f5259b7aab712a1f/html5/thumbnails/12.jpg)
FUZZYCOMPUTERVISIONTOOLBOX FUZZ2017
pg.11
SectionC:FeatureExtraction(1):VisualFeatures(a):ColorDetectorAdigitalimageisnormallyrepresentedusingRGBcolorspaceinthree-dimensionalmatrixwitheachdimension representing the intensity value of Red, Green, and Blue respectively. The intensity isnormallyfrom0to255.
Figure4:Componentsofcolorimage
Colorisveryusefulvisualfeaturesthatcommonlyusedtosegmentaregionofinterestfromanimage.Followingprovideanexampletosegmentdifferentregionsfromthemapimageusingcolorfeatureandvisualizeitindifferentwindowssuchaslake,road,field,andhousingarea.ThiscanbeeasilydonebydistinguisheachofthemusingthedifferentrangeofRGBvalues.YoumaychecktheRGBvaluesfor the map using the following website: http://imagecolorpicker.com/. The lowerbound andupperboundintheexampleindicatethepythonlistwith[R,G,B]value.
FE_colorDetection(image, lowerbound, upperbound, display) Sample Code: imageMap = fcvt.IA_readSource('map.png', True) imageColor = fcvt.FE_colorDetection(imageMap, lowerbound, upperbound, True)
Output:
TheintensityvalueforeachpixelintheR,G,Blayerisnormallyfrom0to255.
![Page 13: Tutorial: Fuzzy Computer Vision Toolbox - C.S. Chancs-chan.com/doc/FCVT2017.pdf · Tutorial: Fuzzy Computer Vision Toolbox FUZZ 2017 Chee Seng Chan cs.chan@um.edu.my Abstract This](https://reader030.fdocuments.net/reader030/viewer/2022040423/5e19a624f5259b7aab712a1f/html5/thumbnails/13.jpg)
FUZZYCOMPUTERVISIONTOOLBOX FUZZ2017
pg.12
lowerbound = [120,185,240] lowerbound = [245,205,100] upperbound = [150,205,260] upperbound = [265,230,170]
lowerbound = [204,220,179] lowerbound = [235,214,228] upperbound = [224,240,199] upperbound = [255,254,248]
(b):EdgeDetectorEdgeofanimageisdetectedbythecapturingthesharpchangesintheimagebrightness.Itprovidesthecontourinformationoranoutlineofanobject.Dependsontheapplication,byapplyinganedgedetectionalgorithmtoanimagemaysignificantlyreducetheamountofdatatobeprocessedinthenextprocessingstage.Itcanthereforefilteroutinformationthatmayberegardedaslessrelevant,while preserving the important structural properties of an image. Following example used cannyoperator[Canny,1986]toextracttheedgeoftheChessboardimage.
FE_edgeDetection(image, method, display) Sample Code: imageChessboard = fcvt.IA_readSource('imageChessboard.png', True) imageEdge = fcvt.FE_edgeDetection(image, True)
Output:
![Page 14: Tutorial: Fuzzy Computer Vision Toolbox - C.S. Chancs-chan.com/doc/FCVT2017.pdf · Tutorial: Fuzzy Computer Vision Toolbox FUZZ 2017 Chee Seng Chan cs.chan@um.edu.my Abstract This](https://reader030.fdocuments.net/reader030/viewer/2022040423/5e19a624f5259b7aab712a1f/html5/thumbnails/14.jpg)
FUZZYCOMPUTERVISIONTOOLBOX FUZZ2017
pg.13
(c):CornerdetectorSameas color andedge, corner is another visual feature thatprovide structure informationof animage.InFCVT,Harriscornerdetector[Harris&Stephens,1988] isusedtoextractthecornerofagiven image. An example is provided below showing the effectiveness of the corner detector inextractingallthecornerfromthechessboardimage.
FE_cornerDetection(image, display) Sample Code: imageChessboard = fcvt.IA_readSource('imageChessboard.png', True) imageCorner = fcvt.FE_cornerDetection(image, True)
Output:
*Thecornersareindicatebyareddot.
(2):HolisticImageFeatures(a):LocalBinaryPatterndetectorLocalBinaryPattern(LBP)[He&Wang,1990] isanimagedescriptorgeneratedforclassificationincomputer vision. It is widely used in two-dimensional texture analysis. LBP is simple yet efficienttextureoperatorwhichlabelsthepixelsofanimagebythresholdingtheneighborhoodofeachpixelandconsiders the resultasabinarynumberas shown inFigure5. It is also robust to illuminationchange and its simplicity makes it possible to analyze images in challenging real-time settings.Generally,blockapproach isemployedtoobtain the localLBPdescriptor forevery localblockandconcatenatetogethertogenerateadescriptortodescribeorrepresenttheimage.Thealgorithmthatextractonedescriptortodescribeawholeimageiscalledaholisticimagefeature.
![Page 15: Tutorial: Fuzzy Computer Vision Toolbox - C.S. Chancs-chan.com/doc/FCVT2017.pdf · Tutorial: Fuzzy Computer Vision Toolbox FUZZ 2017 Chee Seng Chan cs.chan@um.edu.my Abstract This](https://reader030.fdocuments.net/reader030/viewer/2022040423/5e19a624f5259b7aab712a1f/html5/thumbnails/15.jpg)
FUZZYCOMPUTERVISIONTOOLBOX FUZZ2017
pg.14
Figure5:LBPfeatureextraction(ImageadoptedfromWikipedia)
FE_LBPDetection(image, method, display) Sample Code: imageLBP = fcvt.FE_LBPDetection(image, 'uniform', True)
Output: imageLBP = [0.0467 0.0318 0.0178 0.0116 0.0085 0.0074 0.0070 0.0080 0.0095 0.0128 0.0201 0.0408 0.0603 0.0443 0.0212 0.0142 0.0096 0.0083 0.0075 0.0079 0.0097 0.0131 0.0191 0.0298 0.0522 0.4810] * The histogram of the LBP feature.
(3):LocalImageFeatures(a):KeypointdetectorUnlikeLBP,keypointdetectorgeneratesacollectionoffeaturedescriptorthatdescribetheinterestpointtowardstheobject(s)inanimage.Thedescriptorsextractedfromatrainingimage,canthenbeusedtoidentifytheobjectwhenattemptingtolocatetheobjectinatestimagecontainingmanyotherobjects.
![Page 16: Tutorial: Fuzzy Computer Vision Toolbox - C.S. Chancs-chan.com/doc/FCVT2017.pdf · Tutorial: Fuzzy Computer Vision Toolbox FUZZ 2017 Chee Seng Chan cs.chan@um.edu.my Abstract This](https://reader030.fdocuments.net/reader030/viewer/2022040423/5e19a624f5259b7aab712a1f/html5/thumbnails/16.jpg)
FUZZYCOMPUTERVISIONTOOLBOX FUZZ2017
pg.15
Figure6:Imagerecognitionwithkeypoint(Imageadoptedfromgoogleimage)
Toperformreliablerecognition,itisimportantthatthefeaturesextractedfromthetrainingimagebedetectableevenunderchangesinimagescale,orientationandillumination.Suchpointsusuallylieonhigh-contrastregionsoftheimage,suchasobjectedges.Theextractedkeypointsdonotrestrictonthelocationinanimagewhichmeansthattherelativepositionsbetweenthemintheoriginalsceneandtesting imageshouldn'tchangefromone imagetoanother.Scale InvariantFeatureTransform(SIFT) [Lowe, 2004], and Speeded up robust features (SURF) [Bay et al., 2008] are two notablekeypoints detector in computer vision. SIFT uses Scale-space extrema detection with the aid ofDifference ofGaussian (DoG) and Orientation assignment to achieve the robustness in scale andorientation invariant (refer to Figure 7). On the other hand, SURF extract the keypoint byapproximationofthedeterminantofHessianblobdetectorwithaprecomputedintegralimage.SURFisclaimedtofasterthanSIFTintheprocessing.
Figure7:SIFTfeatureextraction(Imageadoptedfromgoogleimage)
*Note:Themethodargumentcanbethefollowings:
i. SIFTii. SURF
FE_keypointDetection(image, method, display) Sample Code: imageKeyPoint = fcvt.FE_keypointDetection(image, 'SIFT', True) imageKeyPoint = fcvt.FE_keypointDetection(image, 'SURF', True)
(Descriptorwith128dimensions)
![Page 17: Tutorial: Fuzzy Computer Vision Toolbox - C.S. Chancs-chan.com/doc/FCVT2017.pdf · Tutorial: Fuzzy Computer Vision Toolbox FUZZ 2017 Chee Seng Chan cs.chan@um.edu.my Abstract This](https://reader030.fdocuments.net/reader030/viewer/2022040423/5e19a624f5259b7aab712a1f/html5/thumbnails/17.jpg)
FUZZYCOMPUTERVISIONTOOLBOX FUZZ2017
pg.16
Output:
(SIFT keypoints) (SURF keypoints)
(4):FeatureRepresentationusingBagofFeature(Forkeypointsdetector)Incomputervision,adescriptor(featurevector)isusedtorepresentanimageoravideoevent.Thedescriptors of images from a dataset will be used to train a classifier with Supervised Learningapproach(e.g.SupportVectorMachine)togenerateaclassifier(socalledtrainedmodel)thatcanbeappliedlaterinimageclassificationtask.HolisticfeaturelikeLBPprovidesusadescriptorthatdescribethewholeimagebutlocalfeaturessuchaskeypointsdetectorgeneratesnumerousdescriptorsfromone image. In imageclassification,onlyonedescriptorper imagewill feed for trainingand testingpurpose.Thismakeslocalfeatureshavingdifficultytodirectlyusedinclassificationstep.Inthistutorial,BagofFeature(BoF)[Fei-Fei&Perona,2005]approachisintroducedasthesolution.
Figure8:OverallBoFframework.
![Page 18: Tutorial: Fuzzy Computer Vision Toolbox - C.S. Chancs-chan.com/doc/FCVT2017.pdf · Tutorial: Fuzzy Computer Vision Toolbox FUZZ 2017 Chee Seng Chan cs.chan@um.edu.my Abstract This](https://reader030.fdocuments.net/reader030/viewer/2022040423/5e19a624f5259b7aab712a1f/html5/thumbnails/18.jpg)
FUZZYCOMPUTERVISIONTOOLBOX FUZZ2017
pg.17
BoForiginsfromBagofWords[Salton&McGill,1983]withtheobjectivetoclassifyadocumentbycomputing the frequencyofwords indictionary.Thisapproachhasproventoworkswell in imageclassification[Fei-Fei&Perona,2005].TheoverallprocessofBoFisshowninFigure8.
The local features (e.g. keypoint) are first assigned to respective cluster by using UnsupervisedLearningapproach (e.g.kmeansclustering)andeachcluster is calledaCodeword.TheCodewordsformadictionarycallcodebook.Thedescriptorofanimageisformbycomputingthefrequencyofcodewordsthatareavailableinthecodebook.ThisstepiscalledQuantisation.Inthelaterstage,thedescriptorsgeneratedfromthedatasetcanbeusedtotraintheclassifierforrecognitionpurpose.Ingeneral,imagefromthesameclasswillhavesimilarcompositionofthecodewords.Belowarethetwofunctionstogeneratecodebookoncethelocalfeaturesareextracted:
FE_Clustering(feaMat, clusterNo) FE_Quantisation(imageKeyPoint, cluster) Sample Code: cluster = fcvt.FE_Clustering(imageKeyPoint , 5) descriptor = fcvt.FE_Quantisation(imageKeyPoint, cluster)
Output: Descriptor = [34 65 78 23 12] * The descriptor is the frequency of the codewords appear in the respective image.
![Page 19: Tutorial: Fuzzy Computer Vision Toolbox - C.S. Chancs-chan.com/doc/FCVT2017.pdf · Tutorial: Fuzzy Computer Vision Toolbox FUZZ 2017 Chee Seng Chan cs.chan@um.edu.my Abstract This](https://reader030.fdocuments.net/reader030/viewer/2022040423/5e19a624f5259b7aab712a1f/html5/thumbnails/19.jpg)
FUZZYCOMPUTERVISIONTOOLBOX FUZZ2017
pg.18
SectionD:ImageClassificationImageClassificationisataskofassigninganinputimagewithlabelfromafixedsetofcategories.First,asufficientamountoftrainingimagesfromdifferentclasses(E.g.Figure9)areusedtotrainaclassifierandtheclassifierwillbeusedtoclassifyatestingimageintorespectiveclass.OSRscenedataset[Oliva&Torralba,2001] isused in this tutorialand isavailable fromhttp://people.csail.mit.edu/torralba/code/spatialenvelope/.
Figure9:TrainingImages
(a)Coast (b)? (c)Forest
Figure10:TestingImages
Theconventionalgoaloftheclassificationtasksistoassignanunknownsceneimagetooneoftheseveral possible classes. For example, Fig. 10(a) is a Coast class while Fig. 10(c) is a Forest class.Intentionally,moststate-of-the-artapproaches in imageclassificationareexemplar-basedandduetheimagesusedaremutuallyexclusivetoeachother.However,thishasoversimplifiesthecomplexrealworldproblemtoasimpleCrispclassificationtask.Asaresultofthis,classificationerrorsoftenoccurwhentheimageclassesthatareoverlapintheselectedfeaturespace.Forexample,itisunclearthatinFig.10(b)isaCoastclassoraForestclass.
Inmanycases,complexrealworldimagesarenon-mutuallyexclusivewheredifferentpeoplearelikelyto respond inconsistently. For examples, scene understanding, human motion analysis, emotionrecognition,etc. InspiredbythefuzzysettheoryproposedbyLotfiZadeh[Zadeh,1965], thisworkstudytheeffectivenessofusingFuzzyQualitativeRankClassifier(FQRC)[Limetal.,2014]torelaxtheassumptionthat theaforementionedcasesaremutuallyexclusive.Therefore, these imagescanbesomewhatarbitraryandpossiblysub-optimal.
Class:Coast Class:Forest
![Page 20: Tutorial: Fuzzy Computer Vision Toolbox - C.S. Chancs-chan.com/doc/FCVT2017.pdf · Tutorial: Fuzzy Computer Vision Toolbox FUZZ 2017 Chee Seng Chan cs.chan@um.edu.my Abstract This](https://reader030.fdocuments.net/reader030/viewer/2022040423/5e19a624f5259b7aab712a1f/html5/thumbnails/20.jpg)
FUZZYCOMPUTERVISIONTOOLBOX FUZZ2017
pg.19
This tutorial covers both Crisp classification and FQRC classification. In FCVT toolbox, the imageclassificationtaskcanbedonebysimplyinvokethefollowingfunction.
Image_classification(Train_folder, Test_folder, feature, method)
User isonly require toprovidethedirectoryof thetrain folder, test folder, typeof feature(‘SIFT’,‘SURF’,or‘LBP’),andclassificationmethod(‘Crisp’or‘Fuzzy’).Theusermayputasmanyclassesinthetraining folder and testing folder with additional folder named “classX” for training and testingpurpose.Nolimitontheamountoftestingandtrainingdatabuttheprocessingtimeandvisualizationmightbeaffected.
(1)CrispClassification(a)SVMClassificationSupportvectormachine(SVM)isasupervisedlearningmodel.Givenasetoftrainingexamples,eachmarkedasbelongingtooneortheotheroftwocategories,anSVMtrainingalgorithmbuildsamodelthatassignsnewexamplestoonecategoryortheother.
Figure11:IllustrationofSVM
(b)ImageClassificationwithCrispApproachSVM isapplied in theCrisp classificationwhere theoutputof the classification resultsare in crispwherebyhereisdeterminedbytheindexoftheclassinthetrainingfolder.Forexample,ifthesystemistrainedwithtwoclassesasinputfromthetrainingfolder,theoutputwillbeeither[0]toindicatetheimagethatbelongstofirstcategory,and[1]tothesecondcategory.Subsequentnumberswillbeusediftheclassinthetrainingfolderismorethantwo.
Sample code: Output_crisp = fcvt.Image_Classification('Training', 'Testing', 'SIFT', 'Crisp')
![Page 21: Tutorial: Fuzzy Computer Vision Toolbox - C.S. Chancs-chan.com/doc/FCVT2017.pdf · Tutorial: Fuzzy Computer Vision Toolbox FUZZ 2017 Chee Seng Chan cs.chan@um.edu.my Abstract This](https://reader030.fdocuments.net/reader030/viewer/2022040423/5e19a624f5259b7aab712a1f/html5/thumbnails/21.jpg)
FUZZYCOMPUTERVISIONTOOLBOX FUZZ2017
pg.20
Output:
(2)FuzzyClassification(FQRC)[Limetal.,2014]Itisundeniablethatcrispclassificationapproachworkswellinmanyclassificationtasksbutlimitedtotheimagesorobjectsthataremutuallyexclusive.However,Ambiguityoruncertaintyisapervasiveelement of many real-world decision making processes. Variation in decisions is a norm in thissituationwhenthesameproblemisposedtodifferentsubjects.Computervisiontaskssuchassceneunderstanding, emotion detection, and human motion analysis are fall into this category.Unfortunately,crispclassifierisunabletodealwiththeuncertaintyorambiguouscaseseffectivelyastheclassifierwillassignoneandonlylabeltoeachtestingimage.
Asasolution,Fuzzyapproachisappliedtorelaxtheaboveissue.Fuzzysettheory[Zadeh,1965] iswidelyusedincontrolsystemnowadayswithincorporationofFuzzyInferenceSystem(FIS).But, inthenatureofcomputervisiontask,itislikelytodealwithhighdimensionalfeatureinput.ThiscausesomeissuestodirectlyapplyFISinthework.Theissuesare:
i. Tediousjobinmanuallydeterminethemembershipfunctionforeachfeature.ii. Almostimpossibletoproducetheassociaterulesforhighdimensionfeaturespace.iii. Complexininferencebasedonextensiverules.
Withthis,FQRCisproposedwiththestrengthincapableofperformingfeaturelearningtoautomatethefuzzymembershipgeneration,andtheinferenceisnotgovernedbyanyrules.Attheendoftheprocess,FQRC is capableofgenerate theanswer in termsof the ranking resultannotatedifferentconfidentvalues.Suchinterpretationiscloserhowhumanperformreasoningtotheambiguouscases.FQRC consists of four stages: 1) Pre-processing (feature extraction); 2) Learning model (fuzzymembership generation); 3) Inference and 4) Ranking interpretation as illustrated in Figure 12.Interestedreadercandownloadthepaperfromhttp://cs-chan.com/doc/TFS2014.pdf.
![Page 22: Tutorial: Fuzzy Computer Vision Toolbox - C.S. Chancs-chan.com/doc/FCVT2017.pdf · Tutorial: Fuzzy Computer Vision Toolbox FUZZ 2017 Chee Seng Chan cs.chan@um.edu.my Abstract This](https://reader030.fdocuments.net/reader030/viewer/2022040423/5e19a624f5259b7aab712a1f/html5/thumbnails/22.jpg)
FUZZYCOMPUTERVISIONTOOLBOX FUZZ2017
pg.21
Figure12.OverallstepsforFQRC(imageadoptedfrom[Limetal.,2014])
Thepre-processingstepalsoknownasfeatureextractionstepthathasbeenexplainedintheprevioussession. The FQRC can supportmost of the feature descriptors such as LBP, SIFT, and SURFwithvarianceinperformancesdependonthenatureoftheapplication.Thistoolboxmainlyfocusontheautomatedmembershipgenerationandtheinferencing.
(a)Fuzzymembershipgeneration(Datadriven)First, the toolboxwill generate themembership function for every feature dimension (number offeaturedimensiondependsonthefeaturedescriptor).Theoretically,inthelearningmodel,itlearnstheimagedatawithparametricapproximationofthemembershipfunctionwherethemembershipdistributionofanormalconvexfuzzynumberisapproximatedbythe4-tuple,𝑚𝑓 = 𝑎𝑏𝛼𝛽 [Liu&Coghill,2009]withthecondition𝑎 < 𝑏and𝑎𝑏 > 0.Therewillbe𝐽×𝐾matrixcontaining4-tupleforeachfeaturenumber,𝑗andclass,𝑘denotedby𝑓𝑞𝑚𝑓.Those4-tuplesarerepresentedintheformas𝑚𝑓23.
𝑓𝑞𝑚𝑓 =𝑚𝑓44 ⋯ 𝑚𝑓46⋮ ⋱ ⋮
𝑚𝑓94 ⋯ 𝑚𝑓96
Nonetheless,histogramanalysisischosentolearnthe4-tuplefuzzynumberasillustratedinFig.13.
![Page 23: Tutorial: Fuzzy Computer Vision Toolbox - C.S. Chancs-chan.com/doc/FCVT2017.pdf · Tutorial: Fuzzy Computer Vision Toolbox FUZZ 2017 Chee Seng Chan cs.chan@um.edu.my Abstract This](https://reader030.fdocuments.net/reader030/viewer/2022040423/5e19a624f5259b7aab712a1f/html5/thumbnails/23.jpg)
FUZZYCOMPUTERVISIONTOOLBOX FUZZ2017
pg.22
Figure13.membershipgenerationfromhistogram
Figure13illustratestheparametricrepresentationofahistogram,𝑥isthefeaturevalue,𝑛denotestheoccurrenceoftrainingdatafromitsrespectivebin𝑛4,𝑛<,…𝑛=.𝑎and𝑏representthelowerandupperboundof𝜇,while𝑎 − 𝛼,and𝑏 + 𝛽representtheminimumandmaximumof𝑥value.Thedominantregionistheareaof[𝑎, 𝑏].
Where,
,with𝑛D > 0
Inthetoolbox,thefunctionthatbuildthemembershipfunctionis:
build4tuplesMF(feaMat , binNum)
Method Implementation: def build4tuplesMF(feaMat , binNum): # Parameters initialization B = binNum #num of bin feaMat = feaMat #feature matrix J = feaMat.shape[1] #num of features (also indicate that num of 4-tuples membership function will be builded at the end) mf = np.zeros((J,4)) mu = []; for j in range(0,J): #start building MF # calculate the bin width, v v = (float(np.amax(feaMat[:,j])) - float(np.amin(feaMat[:,j]))) / float(B) # count the ocurrence of the data in the bin and represent in histogram h = np.histogram(feaMat[:,j],B); N = h[0] xout = h[1]
![Page 24: Tutorial: Fuzzy Computer Vision Toolbox - C.S. Chancs-chan.com/doc/FCVT2017.pdf · Tutorial: Fuzzy Computer Vision Toolbox FUZZ 2017 Chee Seng Chan cs.chan@um.edu.my Abstract This](https://reader030.fdocuments.net/reader030/viewer/2022040423/5e19a624f5259b7aab712a1f/html5/thumbnails/24.jpg)
FUZZYCOMPUTERVISIONTOOLBOX FUZZ2017
pg.23
# calculate how many bins which have distributed data > 0 (denoted as b) b = 0 for n in range(0,len(N)): if (N[n] > 0): b = b + 1; # Calculate mean value for the histogram histMean = float(sum(N)) / b; """ % Find 4-tuple trapezoid position from histogram % _________ % /| |\ % / | | \ % / | | \ % c a b d % % a-c : alpha % d-b : beta % 4-tuple = [a,b,alpha,beta] """ # Scan from left to right to obtain a value for n in range(0,len(N)): if(N[n] >= histMean): a = xout[n] #include the offset to get the lower boundary of that bar break # Scan from right to left to obtain b value for n in range(len(N)-1,-1,-1): if(N[n] >= histMean): b = xout[n+1] #include the offset to get the upper boundary of that bar break # obtain a value c = xout[0] - v; # obtain b value d = xout[len(xout)-1] + v; # compute alpha alpha = a - c; # compute beta beta = d - b; # Output mf[j,:] = [a,b,alpha,beta] mu.append([histMean, N, xout]) return mf,mu
![Page 25: Tutorial: Fuzzy Computer Vision Toolbox - C.S. Chancs-chan.com/doc/FCVT2017.pdf · Tutorial: Fuzzy Computer Vision Toolbox FUZZ 2017 Chee Seng Chan cs.chan@um.edu.my Abstract This](https://reader030.fdocuments.net/reader030/viewer/2022040423/5e19a624f5259b7aab712a1f/html5/thumbnails/25.jpg)
FUZZYCOMPUTERVISIONTOOLBOX FUZZ2017
pg.24
Besidesthat,thetoolboxalsoprovidesthevisualizationfacilitytoviewyourgeneratedmembershipfunctionsorthehistograms.
mfVisualize(fqmf) histVisualize(fqmf, fqmf_mu)
Asanexample,ifIwanttogeneratethemembershipfunctionsforthefeaturevectorswiththreedimenionsfromsixinputs:
Sample code: a = np.array([(1,4,6),(2,5,7),(2,5,8),(3,4,8),(3,5,7),(2,6,9)]) mf,mu = build4tuplesMF(a,3) mfVisualize(mf) histVisualize(mf,mu)
Output: mf = array([[ 1.66666667, 3. , 1.33333333, 0.66666667], [ 4. , 5.33333333, 0.66666667, 1.33333333], [ 7. , 9. , 2. , 1. ]]) Mu = [[2.0, array([1, 3, 2], dtype=int64), array([ 1. , 1.66666667, 2.33333333, 3. ])], [2.0, array([2, 3, 1], dtype=int64), array([ 4. , 4.66666667, 5.33333333, 6. ])], [2.0, array([1, 2, 3], dtype=int64), array([ 6., 7., 8., 9.])]] Computer Visualization:
(Membershipfunctions) (Histograms)
![Page 26: Tutorial: Fuzzy Computer Vision Toolbox - C.S. Chancs-chan.com/doc/FCVT2017.pdf · Tutorial: Fuzzy Computer Vision Toolbox FUZZ 2017 Chee Seng Chan cs.chan@um.edu.my Abstract This](https://reader030.fdocuments.net/reader030/viewer/2022040423/5e19a624f5259b7aab712a1f/html5/thumbnails/26.jpg)
FUZZYCOMPUTERVISIONTOOLBOX FUZZ2017
pg.25
(b)InferenceThegoalhereistorelaxthemutually-exclusiveassumptionontheimagedataandclassifyanunknownscene class into their possibility classes instead of just one. This is unlike the conventional fuzzyinferenceenginethatthedefuzzificationstepeventuallyderivesacrispdecision.Givenatestingimageand its respective feature values𝑥 , themembership valueµof feature𝑗 belong to class𝑘 can beapproximatedby
Thisisthenusedtocalculatetheproduct,𝑃3 ofmembershipvaluesofalltheattributesfor𝑘class,nextinthereference,togeneratetherankingresult,𝑃3isnormalizedagainstthesumof𝑃ofallclassesanddenotedas𝑟3 .
Inthetoolbox,theinferenceresultcanbeobtainedbyfirstdeterminethemembershipvalue:
membershipVal(feature_value, mf)
Method Implementation: def membershipVal(fvalue, mf): # mf -> 4-tuples number retrieve from FQRC (mf = [a b alpha beta]) a = mf[0] b = mf[1] alpha = mf[2] beta = mf[3] if (fvalue >= a and fvalue <= b): # f_value within [a,b] degreeMF = 1 elif (fvalue >= a-alpha and fvalue < a): # x within [a-alpha,a] degreeMF = (fvalue - a + alpha) / alpha elif (fvalue > b and fvalue <= b+beta): # x within [b,b+beta] degreeMF = (b + beta - fvalue) / beta else: degreeMF = 0
return degreeMF
![Page 27: Tutorial: Fuzzy Computer Vision Toolbox - C.S. Chancs-chan.com/doc/FCVT2017.pdf · Tutorial: Fuzzy Computer Vision Toolbox FUZZ 2017 Chee Seng Chan cs.chan@um.edu.my Abstract This](https://reader030.fdocuments.net/reader030/viewer/2022040423/5e19a624f5259b7aab712a1f/html5/thumbnails/27.jpg)
FUZZYCOMPUTERVISIONTOOLBOX FUZZ2017
pg.26
Asanexample:
Sample code: mf = np.array([4, 5, 1, 1]) membership_degree = membershipVal(3.7, mf)
Output: membership_degree = array([ 0.7 ])
thenfollowedbytheinferencemethod:
inference( feaVec, fqmf)
Method Implementation: def inference( feaVec, fqmf): J = len(fqmf[0]) #num of feature K = len(fqmf) #num of class # Obtain degree of membership for each feature value feaDegreeMF = np.zeros((K,J)) for k in range(0,K): for j in range(0,J): degreeMF = membershipVal(feaVec[j], fqmf[k][j]); feaDegreeMF[k][j] = degreeMF; temp = copy.copy(feaDegreeMF) temp[feaDegreeMF > 0] = 1 hitCount = np.sum(temp,axis=1) sumOfdegreeMF = np.sum(feaDegreeMF,axis=1) ratio = np.divide(sumOfdegreeMF, np.amax(hitCount)) sumRatio = sum(ratio) normOfdegreeMF = np.divide(ratio,sumRatio) #Normalization output = normOfdegreeMF if(np.isnan(sum(output))==True or np.isinf(sum(output))==True): output = np.zeros((1,K)) return output, feaDegreeMF
![Page 28: Tutorial: Fuzzy Computer Vision Toolbox - C.S. Chancs-chan.com/doc/FCVT2017.pdf · Tutorial: Fuzzy Computer Vision Toolbox FUZZ 2017 Chee Seng Chan cs.chan@um.edu.my Abstract This](https://reader030.fdocuments.net/reader030/viewer/2022040423/5e19a624f5259b7aab712a1f/html5/thumbnails/28.jpg)
FUZZYCOMPUTERVISIONTOOLBOX FUZZ2017
pg.27
Similarly, the visualization to inspect the cross over degree of membership for each featurecorrespondstoallclassesisprovided.
infVisualize(fqmf)
Asanexample:
Sample code: a = np.array([(1,4,6),(2,5,7),(2,5,8),(3,4,8),(3,5,7),(2,6,9)]) # Class 1 mf_a,mu_a = build4tuplesMF(a,3) b = np.array([(4,6,9),(4,7,10),(3,7,11),(5,7,10),(4,8,10),(5,8,11)]) # Class 2 mf_b,mu_b = build4tuplesMF(b,3) mf_all = [] # To append membership functions for all classes mf_all.append(mf_a) mf_all.append(mf_b) feaVec = np.array([2.5,4.5,9.5]) # New input with feature values output,feaDegreeMF = inference(feaVec, mf_all) infVisualize(feaVec, mf_all, feaDegreeMF)
Output: output = array([ 0.71428571, 0.28571429]) feaDegreeMF = array([[ 1. , 1. , 0.5 ], [ 0.125, 0. , 0.875]])
![Page 29: Tutorial: Fuzzy Computer Vision Toolbox - C.S. Chancs-chan.com/doc/FCVT2017.pdf · Tutorial: Fuzzy Computer Vision Toolbox FUZZ 2017 Chee Seng Chan cs.chan@um.edu.my Abstract This](https://reader030.fdocuments.net/reader030/viewer/2022040423/5e19a624f5259b7aab712a1f/html5/thumbnails/29.jpg)
FUZZYCOMPUTERVISIONTOOLBOX FUZZ2017
pg.28
(c)ClassificationusingFQRCToeasetheuser,theclassificationusingFQRCissimplifiedwiththetrainfunction“CL_FQRC_Train”whichyieldthemembershipfunctions(fqmf)forallfeaturesandclasses,and“CL_FQRC_Predict”topredictanewinputwithusingthefqmfgeneratedfromthetrainingstep.Usercanchoosetovisualizetheresultbyinputing“visualize=True”.
CL_FQRC_Train(X_train, y_train, binNum, visualize) CL_FQRC_Predict(X_test, fqmf, visualize)
In the“CL_FQRC_Train” function,user is require toprovide the featurevectorsobtained fromthetrainingdata(X_train)andthegroundtruthforeachdata(y_train)asanarray.
Xtrain=
Featurej=1 Featurej=2 Featurej=3
1 4 6
2 5 7
.
.
.4 8 10
5 8 11
Sample code: X_train = np.array([(1,4,6),(2,5,7),(2,5,8),(3,4,8),(3,5,7),(2,6,9),(4,6,9),(4,7,10),(3,7,11),(5,7,10),(4,8,10),(5,8,11)]) x_groundTruth = np.array([0,0,0,0,0,0,1,1,1,1,1,1]) fqmf = CL_FQRC_Train(X_train, x_groundTruth, 3, True) feaVec = np.array([2.5,4.5,9.5]) %--> new testing input result = CL_FQRC_Predict(feaVec, fqmf, True) print 'output:' + str(output)
y_train=
GroundTruth
0
0
.
.
.1
1
![Page 30: Tutorial: Fuzzy Computer Vision Toolbox - C.S. Chancs-chan.com/doc/FCVT2017.pdf · Tutorial: Fuzzy Computer Vision Toolbox FUZZ 2017 Chee Seng Chan cs.chan@um.edu.my Abstract This](https://reader030.fdocuments.net/reader030/viewer/2022040423/5e19a624f5259b7aab712a1f/html5/thumbnails/30.jpg)
FUZZYCOMPUTERVISIONTOOLBOX FUZZ2017
pg.29
Output:
result: [0.71428571 0.28571429]
Onecannoticethattheresultgeneratedheisnotacrispoutcomebutthemembership(confident)valueofthenewinputbelongstotherespectiveclass.
![Page 31: Tutorial: Fuzzy Computer Vision Toolbox - C.S. Chancs-chan.com/doc/FCVT2017.pdf · Tutorial: Fuzzy Computer Vision Toolbox FUZZ 2017 Chee Seng Chan cs.chan@um.edu.my Abstract This](https://reader030.fdocuments.net/reader030/viewer/2022040423/5e19a624f5259b7aab712a1f/html5/thumbnails/31.jpg)
FUZZYCOMPUTERVISIONTOOLBOX FUZZ2017
pg.30
(d)ImageClassificationwithFuzzyApproachUsercanusethefollowingcodetoperformimageclassificationwiththeFQRC.
Sample code: Output_fuzzy = fcvt.Image_Classification('Training', 'Testing', 'SIFT', ‘Fuzzy’)
Usingthesamecasestudyinsceneunderstanding,firstthemembershipfunctionforeachfeatureandclassisgeneratedusinghistogram.TheoutputisshownasFigureX,andFigureX.ThisexampleisusingSIFTfeaturewithBoFoffiveclusters(fivedifferentcodewordsinthecodebook).
Basedonthenumberofclassinthetrainfolder,thesystemautomaticallygeneratethecorrespondingmembershipfunctionthatrepresenteachfeaturedimensionforeachclass.
Class:Coast Class:Forest
Feature1
Feature2
Feature3
Feature4
Feature5
![Page 32: Tutorial: Fuzzy Computer Vision Toolbox - C.S. Chancs-chan.com/doc/FCVT2017.pdf · Tutorial: Fuzzy Computer Vision Toolbox FUZZ 2017 Chee Seng Chan cs.chan@um.edu.my Abstract This](https://reader030.fdocuments.net/reader030/viewer/2022040423/5e19a624f5259b7aab712a1f/html5/thumbnails/32.jpg)
FUZZYCOMPUTERVISIONTOOLBOX FUZZ2017
pg.31
Basedon thegeneratedmembership functions, inferencecanbedoneon the testing images.Thesampleoutputareasfollows:
Output:
Class:Coast Class:Forest
Feature1
Feature2
Feature3
Feature4
Feature5
ConfidentasCoast
ConfidentasForest
![Page 33: Tutorial: Fuzzy Computer Vision Toolbox - C.S. Chancs-chan.com/doc/FCVT2017.pdf · Tutorial: Fuzzy Computer Vision Toolbox FUZZ 2017 Chee Seng Chan cs.chan@um.edu.my Abstract This](https://reader030.fdocuments.net/reader030/viewer/2022040423/5e19a624f5259b7aab712a1f/html5/thumbnails/33.jpg)
FUZZYCOMPUTERVISIONTOOLBOX FUZZ2017
pg.32
OneofthestrengthsoftheFQRCisitprovidesthefeasibilitytoperformsingle-labelclassificationtasklikeothercrispclassifiersaswellasrankingasshownintheresults.
*Moreresultscanbeobservedfromthepythonprogram.
![Page 34: Tutorial: Fuzzy Computer Vision Toolbox - C.S. Chancs-chan.com/doc/FCVT2017.pdf · Tutorial: Fuzzy Computer Vision Toolbox FUZZ 2017 Chee Seng Chan cs.chan@um.edu.my Abstract This](https://reader030.fdocuments.net/reader030/viewer/2022040423/5e19a624f5259b7aab712a1f/html5/thumbnails/34.jpg)
FUZZYCOMPUTERVISIONTOOLBOX FUZZ2017
pg.33
References:
Bay,H.,Ess,A.,Tuytelaars,T.,&VanGool,L.(2008).Speeded-uprobustfeatures(SURF).Computervisionandimageunderstanding,110(3),346-359.Canny,J.(1986).Acomputationalapproachtoedgedetection.IEEETransactionsonpatternanalysisandmachineintelligence,(6),679-698.Fei-Fei, L., & Perona, P. (2005, June). A bayesian hierarchical model for learning natural scenecategories.InIEEEInternationalConferenceonComputerVisionandPatternRecognition,Vol.2,pp.524-531).Harris, C., & Stephens,M. (1988, August). A combined corner and edge detector. InAlvey visionconference(Vol.15,No.50,pp.10-5244).He,D.C.,&Wang,L.(1990).Textureunit,texturespectrum,andtextureanalysis.IEEEtransactionsonGeoscienceandRemoteSensing,28(4),509-512.Lim,C.H.,Risnumawan,A.,&Chan,C.S. (2014).Ascene image isnonmutuallyexclusive—afuzzyqualitativesceneunderstanding.IEEETransactionsonFuzzySystems,22(6),1541-1556.Liu,H.,&Coghill,G.M.(2005,October).Fuzzyqualitativetrigonometry.In2005IEEEInternationalConferenceonSystems,ManandCybernetics,(Vol.2,pp.1291-1296).Lowe,D.G.(2004).Distinctiveimagefeaturesfromscale-invariantkeypoints.Internationaljournalofcomputervision,60(2),91-110.Oliva,A.,&Torralba,A. (2001).Modeling the shapeof the scene:Aholistic representationof thespatialenvelope.Internationaljournalofcomputervision,42(3),145-175.Otsu, N. (1979). A threshold selection method from gray-level histograms. IEEE transactions onsystems,man,andcybernetics,9(1),62-66.Salton,G.,&McGill,M.J.(1983).IntroductiontomoderninformationPhiladelphia,PA.AmericanAssociationforArtificialIntelligenceretrieval.Zadeh,L.A.(1965).Fuzzysets.Informationandcontrol,8(3),338-353.