mrnugget / opencv-haar-classifier-training

Learn how to train your own OpenCV Haar classifier
Other
735 stars 470 forks source link

Step 1 opencv-haar-classifier-training error #41

Closed rajarao47 closed 7 years ago

rajarao47 commented 7 years ago

Hi, 1) I tried step 2 to step 4. Had about 675 positive and1970 negative pictures. I could generate positives.txt and negatives.txt files. while running step 5:(below) perl bin/createsamples.pl positives.txt negatives.txt samples 1700 "opencv_createsamples -bgcolor 0 -bgthresh 0 -maxxangle 1.1 -maxyangle 1.1 maxzangle 0.5 -maxidev 40 -w 24 -h 24" I am receiving error as below: it gave error as: Error is: syntax error near unexpected token "(".

2) I realized that I missed step 1. Hence, I restarted the process and entered the first command as below and got message as below:

root@rajas01:~/rajashaar2# brew tap homebrew/science W: be careful as root.

======================================================================== You may want to update following environments after installed linuxbrew.

PATH, MANPATH, INFOPATH

(example: /usr/share/doc/linuxbrew-wrapper/examples/profile)

Don't run this as root! root@rajas01:~/rajashaar2# Don't run this as root!


It indicates a warning as do not run this as root! I have gone through previous correspondences and unable to locate any solution for this. Am I missing any step here? Please help. (Note: I am trying this on web server installed with Ubuntu.)

mrnugget commented 7 years ago

Regarding 1.: See https://github.com/mrnugget/opencv-haar-classifier-training/issues/4 Regarding 2.: the error comes from the fact that you're running this on Ubuntu. brew is a package manager for macOS.

rajarao47 commented 7 years ago

Hi Nugget, Thanks for your help. I did more research and realized that brew package is for mac OS. (Sorry for this as I am just bit new in programming and exploring slowly) While running step 5, I am still getting below error message as sh 1: ### Syntax error: "(" unexpected "Samples' folder is still empty.

opencv_createsamples -bgcolor 0 -bgthresh 0 -maxxangle 1.1 -maxyangle 1.1 -maxzangle 0.5 -maxidev 40 -w 24 -h 25 -img ./positive_images/posi (431).jpg -bg tmp -vec samples/posi (431).jpg.vec -num 2 sh: 1: Syntax error: "(" unexpected opencv_createsamples -bgcolor 0 -bgthresh 0 -maxxangle 1.1 -maxyangle 1.1 -maxzangle 0.5 -maxidev 40 -w 24 -h 25 -img ./positive_images/posi (399).jpg -bg tmp -vec samples/posi (399).jpg.vec -num 2 sh: 1: Syntax error: "(" unexpected opencv_createsamples -bgcolor 0 -bgthresh 0 -maxxangle 1.1 -maxyangle 1.1 -maxzangle 0.5 -maxidev 40 -w 24 -h 25 -img ./positive_images/posi (343).jpg -bg tmp -vec samples/posi (343).jpg.vec -num 2 sh: 1: Syntax error: "(" unexpected opencv_createsamples -bgcolor 0 -bgthresh 0 -maxxangle 1.1 -maxyangle 1.1 -maxzangle 0.5 -maxidev 40 -w 24 -h 25 -img ./positive_images/posi (208).jpg -bg tmp -vec samples/posi (208).jpg.vec -num 2 sh: 1: Syntax error: "(" unexpected opencv_createsamples -bgcolor 0 -bgthresh 0 -maxxangle 1.1 -maxyangle 1.1 -maxzangle 0.5 -maxidev 40 -w 24 -h 25 -img ./positive_images/posi (562).jpg -bg tmp -vec samples/posi (562).jpg.vec -num 2 sh: 1: Syntax error: "(" unexpected opencv_createsamples -bgcolor 0 -bgthresh 0 -maxxangle 1.1 -maxyangle 1.1 -maxzangle 0.5 -maxidev 40 -w 24 -h 25 -img ./positive_images/posi (185).jpg -bg tmp -vec samples/posi (185).jpg.vec -num 2 sh: 1: Syntax error: "(" unexpected opencv_createsamples -bgcolor 0 -bgthresh 0 -maxxangle 1.1 -maxyangle 1.1 -maxzangle 0.5 -maxidev 40 -w 24 -h 25 -img ./positive_images/posi (535).jpg -bg tmp -vec samples/posi (535).jpg.vec -num 2 sh: 1: Syntax error: "(" unexpected

Kindly help. Is there any alternate command required for Ubuntu instead of brew

mrnugget commented 7 years ago

Try removing the "(", ")" and whitespace from the file names.

On 12. Jul 2017, 08:21 +0200, rajarao47 notifications@github.com, wrote:

Hi Nugget, Thanks for your help. I did more research and realized that brew package is for mac OS. (Sorry for this as I am just bit new in programming and exploring slowly) While running following step 5 is am getting below message and error as sh 1: Syntax error: "(" unexpected "Samples' folder is still empty. opencv_createsamples -bgcolor 0 -bgthresh 0 -maxxangle 1.1 -maxyangle 1.1 -maxzangle 0.5 -maxidev 40 -w 24 -h 25 -img ./positive_images/posi (431).jpg -bg tmp -vec samples/posi (431).jpg.vec -num 2 sh: 1: Syntax error: "(" unexpected opencv_createsamples -bgcolor 0 -bgthresh 0 -maxxangle 1.1 -maxyangle 1.1 -maxzangle 0.5 -maxidev 40 -w 24 -h 25 -img ./positive_images/posi (399).jpg -bg tmp -vec samples/posi (399).jpg.vec -num 2 sh: 1: Syntax error: "(" unexpected opencv_createsamples -bgcolor 0 -bgthresh 0 -maxxangle 1.1 -maxyangle 1.1 -maxzangle 0.5 -maxidev 40 -w 24 -h 25 -img ./positive_images/posi (343).jpg -bg tmp -vec samples/posi (343).jpg.vec -num 2 sh: 1: Syntax error: "(" unexpected opencv_createsamples -bgcolor 0 -bgthresh 0 -maxxangle 1.1 -maxyangle 1.1 -maxzangle 0.5 -maxidev 40 -w 24 -h 25 -img ./positive_images/posi (208).jpg -bg tmp -vec samples/posi (208).jpg.vec -num 2 sh: 1: Syntax error: "(" unexpected opencv_createsamples -bgcolor 0 -bgthresh 0 -maxxangle 1.1 -maxyangle 1.1 -maxzangle 0.5 -maxidev 40 -w 24 -h 25 -img ./positive_images/posi (562).jpg -bg tmp -vec samples/posi (562).jpg.vec -num 2 sh: 1: Syntax error: "(" unexpected opencv_createsamples -bgcolor 0 -bgthresh 0 -maxxangle 1.1 -maxyangle 1.1 -maxzangle 0.5 -maxidev 40 -w 24 -h 25 -img ./positive_images/posi (185).jpg -bg tmp -vec samples/posi (185).jpg.vec -num 2 sh: 1: Syntax error: "(" unexpected opencv_createsamples -bgcolor 0 -bgthresh 0 -maxxangle 1.1 -maxyangle 1.1 -maxzangle 0.5 -maxidev 40 -w 24 -h 25 -img ./positive_images/posi (535).jpg -bg tmp -vec samples/posi (535).jpg.vec -num 2 sh: 1: Syntax error: "(" unexpected Kindly help. Is there any alternate command required for Ubuntu instead of brew — You are receiving this because you modified the open/close state. Reply to this email directly, view it on GitHub, or mute the thread.

rajarao47 commented 7 years ago

Hi, I have corrected the naming of the .jpg files. It worked fine now. Thanks for your help.