[Fault Diagnosis Analysis] Rolling bearing fault diagnosis feature extraction with Matlab code

?About the author: A Matlab simulation developer who loves scientific research. He cultivates his mind and improves his technology simultaneously. For code acquisition, paper reproduction and scientific research simulation cooperation, please send a private message. Personal homepage: Matlab Research Studio Personal credo: Investigate things to gain knowledge. For more complete Matlab code and simulation customization […]

Matlab implementation: image edge extraction

1. Edge extraction algorithm Method 1: First-order differential operator Sobel operator The Sobel operator detection method has a better processing effect on images with grayscale gradients and more noise. The Sobel operator is not very accurate in edge positioning, and the edge of the image is more than one pixel. Roberts operator The Roberts operator […]

[Fault Diagnosis Analysis] Rolling bearing fault diagnosis feature extraction with Matlab code

?About the author: A Matlab simulation developer who loves scientific research. He cultivates his mind and improves his technology simultaneously. For code acquisition, paper reproduction and scientific research simulation cooperation, please send a private message. Personal homepage: Matlab Research Studio Personal credo: Investigate things to gain knowledge. For more complete Matlab code and simulation customization […]

[Record] PDF|Chinese and English PDF scanned version directory extraction (1, QQ+GPT)

need: 1) Quickly extract table of contents from PDF; 2) Don’t want to download any software. Article directory 1. Directly export the directory using existing commonly used software 1 (recommendation index☆) QQ OCR text recognition 2 (recommendation index 0 stars) GPT4 image recognition 3 (recommended index 0 stars) GPT4 AI PDF plug-in 4 (recommended index […]

Target detection (2) Feature extraction of traditional target detection and recognition – Viola Jones detection principle based on Haar-like features

TableofContents Introduction integralplot Trainoptimalweakclassifier Trainastrongclassifier strongclassifier Cascadeclassifier Introduction TheViolaJonesdetectorconsistsofthreecoresteps,namelyHaar-likefeatureandintegralmap,Adaboostclassifierandcascadeclassifier.Supposethatduringtargetdetection,suchasub-windowisneededtocontinuouslyslideandmoveintheimagetobedetected.Everytimethesub-windowreachesaposition,thecharacteristicsoftheareawillbecalculated,andthenthetrainedcascadeclassifierwillbeusedtoFeaturesarefiltered,andaslongasthefeaturepassesthescreeningofallstrongclassifiers,theareaisdeterminedtobethetargetarea. AsshowninFigure9.3,thereare5differentHaar-likefeatureoperators.Assumethatthetotalgrayvalueoftheblackareaineachpictureis?,andthetotalgrayvalueofthewhiteareais.Theresultobtainedis:Haar-likeeigenvaluesofthesub-windowarea. Figure9.3haarfeatures Therectangularfeaturecanbelocatedatanypositionintheimagewindow,anditssizecanalsobechangedatwill.Therefore,therectangularfeaturevalueisdeterminedbythethreefactorsofhaarfeatureoperatorcategory,rectangularpositionandrectangularsize.Therefore,changesincategory,size,andposition,sothatsmallerpictureswillalsocontainmanyrectangularfeatures. Takinga24×24windowasanexample,fivedifferentHaar-likefeatureoperatorsareusedforcalculationinFigure9.3.ThenumberofeigenvaluesofthefiveHaar-likefeatureoperatorsare:43200,43200,27600,27600,20736,atotalof160381.Theimagewindowof24×24sizealonehasmorethan160,000featurevalues.Now,wearefacedwithtwoproblems: Facedwithsomanyeigenvalues,howtooptimizecalculationsandreducetheamountofcalculations? Therearetoomanyeigenvalues.Theremustbesomeeigenvaluesthatarebetteratidentifyingpositivesamplesandnegativesamples,andsomethatarenotgoodatdistinguishingpositivesamplesfromnegativesamples.Sample.Sohowtofindthesegood,excellentfeatures,thatis,theoptimalweakclassifier. IntegralChart First,tosolvethefirstproblem,youneedtousetheintegralmap.Foragrayscaleimage,thevalueofanypointintheintegralmapisthegrayscaleofallpointsintherectangularareaformedbythispointfromtheupperleftcorneroftheoriginalimage.Thesumofthevalues,asshowninFigure9.4:theleftpictureistheoriginalimage,therightpictureistheintegralimage,the3rdrowand4thcolumnintheintegralimagearethepixelsumoftheyellowboxareaintheoriginalimage,the5thintheintegralimageThesecondcolumnoftherowisthepixelsumofthepurpleboxareaintheoriginalimage. Figure9.4Integralplot TheformulashowninFigure9.4canconstructanintegralgraph,butgenerallythefollowingformulaisusedtoconstructanintegralgraph: representsthecumulativesumofthepixelvaluesofthefirstjrowoftheimagei,initialized Userepresentsanintegralimage,initialized Scantheimagelinebylineandcalculatetheaccumulationofeachpixelii,jand,thecalculationmethodsareasfollows: Scantheimageonce.Whenthepixelinthelowerrightcorneroftheimageisreached,theintegralmapii(i,j)iscompleted.Howtocalculatethesumofpixelsinacertainrectangularareaoftheimagethroughtheintegralmap? AsshowninFigure9.5:Intheoriginalimage,therearefourareasA,B,C,andD,wherea,b,c,anddrepresentthefourverticesoftheDarea.HowtocalculatetheintegraldiagramofareaD? Figure9.5Imagearea Use,,,representa,binFigure9.5,respectively.Theintegralvaluesofthefourpointscandd.Usethefollowingequation9.3tocalculatethetotalgrayvalueofthepixelsinareaD: Accordingtotheabovetheory,itcanbefoundthataftertheintroductionofintegralmaptechnology,theHaar-likerectangularfeaturevalueofanimageisonlyaffectedbythevalueofitscorrespondingintegralmap,andthechangeofthecoordinatesoftheimage’spositionhasnocorrelationwithitsvalue.Inthisway,thetimetakentocalculatefeaturevaluescanbeshortenedwhencalculatingrectangularfeatures. Traintheoptimalweakclassifier Nowlet’ssolvethesecondproblem.Therearetoomanyfeatures,soweneedtoscreenthefeaturesandselecttheoptimalweakclassifier.TheinitialweakclassifiermaybejustabasicHaar-likefeature.ItcalculatestheHaar-likefeaturevalueoftheinputimageandcomparesitwiththefeaturevalueoftheinitialweakclassifiertodeterminewhethertheinputimageisaface.However,thisweakclassifierItistoocrudeandmaynotbebetterthanrandomjudgment.Theincubationofweakclassifiersistotrainweakclassifierstobetheoptimalclassifier.Notethattheoptimalclassifierisnotastrongclassifier,butaweakclassifierwitharelativelylowerror.,trainingaweakclassifierisactuallytheprocessofsettinguptheclassifier.Asforhowtosetuptheclassifierandwhattoset,let’sfirstlookatthemathematicalstructureoftheweakclassifierasshowninEquation9.4: Theparameterxisthecharacteristicwindow,prepresentsthedifferentdirectionsoftheinequality,withvaluesof1and-1,andgistherectangularwindow.ThecorrespondingHaar-likefeaturevalue,θ,isthejudgmentthresholdoftheweakclassifier. ThemostbasicweakclassifieronlycontainsoneHaar-likefeature,whichmeansthatthedecisiontreehasonlyonelayer,calledastump.Tocomparethefeaturevaluesoftheinputimageandtheweakclassifierfeatures,athresholdisneeded.Whenthefeaturevalueoftheinputimageisgreaterthanthethreshold,itisdeterminedtobeaface.Theprocessoftrainingtheoptimalweakclassifierisactuallytofindasuitableclassifierthresholdsothattheclassifierhasthelowestjudgmenterrorforallsamples.Thespecificoperationprocessisasfollows: Findtheoptimalthresholdthatminimizestheclassificationerror.Withthisthreshold,thefirstoptimalweakclassifierisborn,ThebirthofthefirstoptimalweakclassifiermeansthatthebestHaar-likefeaturevaluehasbeenscreenedout. Trainstrongclassifier Weakclassificationisonlyaclassifierwithacertainclassificationability,anditsratiocannotmeetthebasicrequirementsforaclassifier,soitneedstobefurtherstrengthenedtobuildastrongclassifierbasedontheweakclassifier.Thespecifictrainingstepsareasfollows: Initializethesampletrainingset Trainingsampleset(x1,y1),…,(xn,yn),whereyi∈0,1,yiisthepositiveandnegativesampleidentifier,1ispositive,otherwiseitisnegative. Initializesampleweightsbasedonthenumberofpositiveandnegativesamples Theinitialweightofthepositivesampleis,theinitialweightofthenegativesampleis,wherem,listhetotalnumberoffacesamplesandthetotalnumberofnon-facesamples,andthetotalnumberofallsamplesisnem>,andsatisfytheconditionofn=m+l,isusedtorepresenttheweight,wheretreferstothetthalgorithmiteration,jreferstothejthoneinthetrainingsample Iterativetrainingofweakclassifiers StrongClassifier Thefinalstrongclassifierisrecordedas: Amongthem,indicatesthemaximumnumberoftrainingtimes. CascadeClassifier AstrongclassifiercanbeconstructedthroughthetrainingoftheaboveAdaBoostalgorithm,buttheaccuracyofsuchaclassifierstillneedstobeimproved,sothestrongclassifierisnotthefinalstructureoftheclassifier.Inordertomaketheaccuracyanddetectionefficiencyoftheclassifierbetter,youcanUsethecascademethodtocombinestrongclassifiersintoacascadeclassifier. Figure9.6Cascadeclassifier Infact,thepurposeoftrainingacascadeclassifieristomakedetectionmoreaccurate.ThedetectionsystemoftheHaarclassifiertakesanimageinrealityasinput,andthenperformsmulti-regionandmulti-scaledetectionontheimage.Theso-calledmulti-Regionistodividetheimageintomultipleblocksanddetecteachblock. Sincethephotosusedfortrainingareonlysmallimagesofabout20*20,multi-scaledetectionisrequiredforlargefaces.Multi-scaledetectionmechanismsgenerallyhavetwostrategies.Oneisnottochangethesizeofthesearchwindow.However,bycontinuouslyscalingtheimage,thismethodrequiresthecalculationofregionalfeaturevaluesforeachscaledimage,whichisnotefficient. Anothermethodistocontinuouslyinitializethesearchwindowsizetotheimagesizeduringtraining,continuouslyexpandthesearchwindow,andperformsearches,whichsolvesthedisadvantagesofthefirstmethod.Duringtheprocessofareaenlargement,thesamefacewillbedetectedmultipletimes,whichrequiresthemergingofareas.Nomatterwhichsearchmethodisused,alargenumberofsub-windowswillbeoutputfortheinputimage.Thesesub-windowswillbecontinuouslyfiltered,discardedorpassedbythefirstnodethroughthefilteringcascadeclassifier,asshowninFigure9.6. UsetheViolaJonesclassifierprovidedbyopencvtodetectfacesandeyes.Theimplementationcodeisasfollows: importcv2 #Loadclassifier eye_cascade=cv2.CascadeClassifier(cv2.data.haarcascades,’haarcascade_eye.xml’) img=cv2.imread(‘image/lenna.bmp’)#Loaddetectionimages gray=cv2.cvtColor(img,cv2.COLOR_BGR2GRAY) #Performtargetdetectiononimagesthroughtheclassifier […]

[Fault Diagnosis Analysis] Rolling bearing fault diagnosis feature extraction with Matlab code

?About the author: A Matlab simulation developer who loves scientific research. He cultivates his mind and improves his technology simultaneously. For code acquisition, paper reproduction and scientific research simulation cooperation, please send a private message. Personal homepage: Matlab Research Studio Personal credo: Investigate things to gain knowledge. For more complete Matlab code and simulation customization […]

[Image Segmentation] Image detection (segmentation, feature extraction), measurement and filtering of various features (area, etc.) (Matlab code implementation)

Welcome to this blog Advantages of bloggers:Blog content should be as thoughtful and logical as possible for the convenience of readers. Motto:He who travels a hundred miles is half as good as ninety. The directory of this article is as follows: Table of Contents 1 Overview 2 Operation results ? 3 References 4 Matlab code […]

Frame extraction processing of something-somethingV2 data set

Regarding the problems I encountered when processing the ssv2 data set, it’s really terrible. Although it’s not a big problem, it can mess with people’s mentality. 1. Brief introduction to the problem Because the ssv2 data set is all videos, unlike ssv1 which has ready-made jpg images, the video needs to be extracted and processed […]

Web page data extraction — regular expressions

Table of Contents 1 Overview 2. Metacharacters Basic metacharacters: Repeating metacharacters: Positional metacharacters: Other metacharacters Escapes: 3. Commonly used regular expressions 4. Methods of re module 5. Advanced use of regular expressions .*? pattern modifier 6. Regular parsing data demo 1. Overview Regular Expression, translated as regular expression or regular expression, represents a regular expression, […]