Ask Your Question
0

Filtering matches from net - retrain advised?

asked 2018-04-25 01:14:19 -0600

holger gravatar image

Hello, I successfuly was able to run https://docs.opencv.org/3.4.0/da/d9d/... So i now have a model one which i can recognizes items, lets say bananas. But it will detect much more too.

The obvious way would be to just filter the results based on the classname but this seem not the right way to do somehow. I am worrying a bit about accuracy and performance. Should i retrain the model to only detect my object(banana)? This is a wild idea from me as i am new. I could also dig deeper into the dnn model and maybe manipulate layers / pins.

Maybe i am worrying to much and filtering based on classname is way to go and i should just make sure my model always recognizes my desired object. If this is the case: * Is it a good idea to load the model and train it futher with open cv dnn ? * How to save such a model ?

Thank a lot again + Greetings, Holger

edit retag flag offensive close merge delete

Comments

"Should i retrain the model to only detect my object(banana)? " -- that is quite commonly done, so not a wild idea.

unfortunately, you cannot do this from inside opencv, you'd need the original darknet code.

maybe @StevenPuttemans has a more detailled answer ?

berak gravatar imageberak ( 2018-04-25 01:22:19 -0600 )edit

Ohh - sad to hear i cannot further train and save the model with open cv(open cv internal formats or classifiers would be ok) - that would be awsome but maybe out of focus of the library. I have to install a dnn for training anyway.

holger gravatar imageholger ( 2018-04-25 01:32:49 -0600 )edit

you can easily retrain classifiers with opencv means (just throw away the last dense layers, and add an ANN or such there instead) ,but not the object-detection ones. opencv's dnn has no backpropagation, and thus can't "learn".

berak gravatar imageberak ( 2018-04-25 01:41:41 -0600 )edit

Got it - thank you! Will come back on retraining a classifier later - thats very good news for me :-) Btw what does ANN stands for - a certain type of layer?

holger gravatar imageholger ( 2018-04-25 01:42:46 -0600 )edit

ANN_MLP it's a network on it's own. basically, you would use the existing pretrained googlenet cnn layers as a "fixed function" preprocessor, and do your own classification, with your own (additional) data

berak gravatar imageberak ( 2018-04-25 01:54:55 -0600 )edit

Thank you for the explanation and the link - i would like to raise a question on this later. But before i try to google and search here in example / forum. Also getting the nightly is maybe a good idea as this readNet() could be usefull when trying several dnns.

holger gravatar imageholger ( 2018-04-25 02:00:28 -0600 )edit

indeed, getting latest is always a good idea here ! (e.g. support for yolov3 was added a few days ago!)

berak gravatar imageberak ( 2018-04-25 02:03:33 -0600 )edit

i learned about yolov3 painfully XD

holger gravatar imageholger ( 2018-04-25 02:04:36 -0600 )edit

1 answer

Sort by » oldest newest most voted
1

answered 2018-04-25 05:57:03 -0600

I would suggest retraining for a single class. It makes common sense that you do not want nodes in your network to remember classes you will never use and thus make your detector weaker for the actual class you are looking for. Retraining using the YoloV2 architecture is quite straightforward and PJReddie explains it quite well on his own website. I would suggest trying YoloV2 first, because it is actually the most powerfull architecture of the 3 versions. YoloV3 still has some issues, that you can avoid if the actual problem it tries to solve (very small objects in ratio to the image dimensions) is not occuring in your dataset!

edit flag offensive delete link more

Comments

1

I am using yolov2 so thats good news for me. You are confirming what i was assuming/afraid of - retraining would be really better. You gave me a link so ill walk through this.

holger gravatar imageholger ( 2018-04-25 07:59:29 -0600 )edit

Question Tools

1 follower

Stats

Asked: 2018-04-25 01:14:19 -0600

Seen: 125 times

Last updated: Apr 25 '18