Cov txheej txheem:

Tsim OpenCV Image Classifiers Siv Python: 7 Cov Kauj Ruam
Tsim OpenCV Image Classifiers Siv Python: 7 Cov Kauj Ruam

Video: Tsim OpenCV Image Classifiers Siv Python: 7 Cov Kauj Ruam

Video: Tsim OpenCV Image Classifiers Siv Python: 7 Cov Kauj Ruam
Video: Computer Vision with Python! Resizing Images 2024, Hlis ntuj nqeg
Anonim
Tsim OpenCV Image Classifiers Siv Python
Tsim OpenCV Image Classifiers Siv Python

Haar classifiers hauv nab hab sej thiab opencv yog qhov nyuaj tab sis txoj haujlwm yooj yim.

Peb feem ntau ntsib cov teeb meem hauv kev nrhiav duab thiab kev faib tawm. qhov zoo tshaj plaws solutio yog los tsim koj tus kheej cais. Nov peb kawm paub tsim peb tus kheej cov duab cais nrog ob peb lus txib thiab ntev tab sis yooj yim cov kev pab cuam nab nab

Kev faib tawm yuav tsum muaj ntau tus lej ntawm cov duab tsis zoo thiab qhov tsis zoo tsis muaj cov khoom xav tau thaum qhov zoo yog qhov uas muaj cov khoom uas yuav raug kuaj pom.

Txog 2000 qhov tsis zoo thiab qhov xav tau yog xav tau. Qhov kev pab cuam nab nab hloov cov duab rau grayscale thiab qhov loj me uas tsim nyog kom cov neeg faib khoom siv sijhawm zoo tshaj plaws los tsim.

Kauj Ruam 1: Yuav tsum muaj cov software

Koj xav tau cov software hauv qab no rau kev tsim koj tus kheej cais

1) OpenCV: version kuv siv yog 3.4.2. qhov version tau yooj yim muaj nyob hauv is taws nem.

2) Python: Tus qauv siv yog 3.6.2. Tau rub tawm los ntawm python.org

Ntxiv mus koj xav tau lub webcam (tau kawg).

Kauj ruam 2: Rub tawm cov Duab

Thawj kauj ruam yog ua kom pom cov duab meej ntawm cov khoom kom raug cais.

Qhov loj me yuav tsum tsis loj heev vim nws siv sijhawm ntau dua rau lub khoos phis tawj ua haujlwm. Kuv coj 50 los ntawm 50 loj.

Tom ntej no peb rub cov duab tsis zoo thiab zoo. Koj tuaj yeem pom lawv hauv online. Tab sis peb siv tus nab npawb nab npawb los rub cov duab los ntawm 'https://image-net.org'

Tom ntej no peb hloov cov duab rau greyscale thiab rau qhov loj me. Qhov no yog alo tau ua tiav hauv txoj cai. Txoj cai tseem tshem tawm cov duab tsis raug

Txog tam sim no koj phau ntawv teev npe yuav tsum muaj cov khoom duab piv txwv li watch5050-j.webp

Yog tias cov ntaub ntawv tsis tau tsim, ua nws tus kheej

Tus nab npawb nab npawb yog muab rau hauv.py cov ntaub ntawv

Kauj Ruam 3: Tsim Cov Qauv Zoo hauv OpenCV

Tsim Cov Qauv Zoo hauv OpenCV
Tsim Cov Qauv Zoo hauv OpenCV
Tsim Cov Qauv Zoo hauv OpenCV
Tsim Cov Qauv Zoo hauv OpenCV

Tam sim no mus rau opencv_createsamples directory thiab ntxiv txhua cov ntsiab lus hais los saum no

hauv qhov ua kom sai mus rau C: / opencv342 / build / x64 / vc14 / bin kom pom opencv_createsamples thiab opencv_traincascade apps

tam sim no ua cov lus txib hauv qab no

opencv_createsamples -img watch5050-j.webp

Cov lus txib no yog txhawm rau tsim qhov piv txwv zoo ntawm qhov khoom 1950 kom raug thiab Cov lus piav qhia cov ntaub ntawv info.lst ntawm cov duab zoo cov lus piav qhia yuav tsum zoo li no 0001_0014_0045_0028_0028-j.webp

Tam sim no daim nplaub tshev muaj

ntaub ntawv

cov duab nplaub tshev

bg.txt cov ntaub ntawv

npliag cov ntaub ntawv tais ceev tseg

Kauj Ruam 4: Tsim Cov Ntaub Ntawv Vector Zoo

Tsim Cov Ntaub Ntawv Vector Zoo
Tsim Cov Ntaub Ntawv Vector Zoo

Tam sim no tsim cov ntaub ntawv vector zoo uas muab txoj hauv kev rau cov duab zoo cov ntaub ntawv decsription

Siv cov lus txib hauv qab no

opencv_createsamples -info info/info.lst -num 1950 -w 20 -h 20 -vec positives.vec

Txog tam sim no cov ntsiab lus ntawm cov npe yuav tsum yog cov hauv qab no:

-nug

---- negimages.jpg

--opencv

-cov ntaub ntawv

--data

--positives.vec

--bg.txt

--watch5050-j.webp

Kauj Ruam 5: Qhia tus Classifier

Kev cob qhia Classifier
Kev cob qhia Classifier
Kev cob qhia Classifier
Kev cob qhia Classifier
Kev cob qhia Classifier
Kev cob qhia Classifier

Tam sim no cia qhia lub haar cascade thiab tsim cov ntaub ntawv xml

Siv cov lus txib hauv qab no

opencv_traincascade -data data -vec positives.vec -bg bg.txt -numPos 1800 -numNeg 900 -numStages 10 -w 20 -h 20

cov theem yog 10 Ua kom nce qib yuav siv sijhawm ntau dua tab sis kev faib tawm yog txoj hauv kev ntau dua.

Tam sim no haarcascade tau tsim Nws yuav siv sijhawm li ob teev los ua kom tiav Qhib cov ntaub ntawv tais ceev tseg nyob ntawd koj yuav pom cascade.xml Qhov kev faib tawm uas tau tsim

Kauj Ruam 6: Kuaj Cov Classifier

Cov ntaub ntawv tais ceev tseg muaj cov ntaub ntawv raws li qhia hauv daim duab saum toj no.

Tom qab tsim cov kev faib tawm peb pom tias tus neeg ua haujlwm cais ua haujlwm lossis tsis yog los ntawm kev ua haujlwm object_detect.py program. Tsis txhob hnov qab tso cov ntaub ntawv classifier.xml hauv cov npe nab hab sej.

Kauj Ruam 7: Ua Tsaug Tshwj Xeeb

Kuv xav ua tsaug Sentdex ntawm no uas yog tus kws tsim nab nab raj zoo.

Nws muaj lub npe youtube nrog lub npe hais los saum toj no thiab cov vis dis aus uas tau pab kuv ntau muaj qhov txuas no

Feem ntau ntawm cov cai tau theej los ntawm sentdex. Txawm hais tias tau txais kev pab ntau los ntawm sentdex, Kuv ntsib ntau qhov teeb meem tseem. Kuv tsuas yog xav qhia kuv qhov kev paub.

Kuv vam tias qhov kev nkag siab no tau pab koj !!! Nyob twj ywm kom paub ntau ntxiv.

BR

Tahir Ul Haq

Pom zoo: