I have CNN architecture for object detection ( one object in image ) in KERAS. It has 22 Convolutional layers ( layer includes max pool , LeakyRelu and Batchnorm )

The last layes are following


Basicly i want to output vector that reresents ( probability that is is ObjECT , probability that it isnt , x , y , xmax, ymax )

I am feeding it data that has one object in it and labels

( 1, 0, xmin , ymin , xmax , ymax )

This has around 0.60% accuracy. However the sum of (isOBject + isntObject ) is greater than 1.

[[   1.02664185    0.34075582  231.69602966  241.59547424  280.6262207

Hos is this possible.

Also when i feed network another data that does NOT have object in it and labl them

( 0, 1 , 0, 0, 0, 0 ).

I get 10% accuracy. How can it be? It has more data to learn from and added false data on top of that.

I appreciate all tips and tricks / explanation, basicly all help. Thanks


1 Answer 1


You need to use appropriate activations. If you were using softmax for those two components, they'd be constrained to sum to one. LeakyReLU not only doesn't impose this constraint: it can output any real value, so it isn't even constrained to [0,1] for those components individually.

  • $\begingroup$ Can i use one activations for first 2 parameters, and second for other 4? $\endgroup$
    – trolkura
    Mar 23, 2018 at 10:12
  • $\begingroup$ Of course you can. Use the functional API instead of sequential, and treat it as two separate output layers: one with two softmax nodes, and one with 4 LeakyReLU or whatever. $\endgroup$
    – David Marx
    Mar 23, 2018 at 10:15
  • $\begingroup$ Please. Would like be willing go demonstrate simple example? $\endgroup$
    – trolkura
    Mar 23, 2018 at 10:16
  • $\begingroup$ This is the basic idea: datascience.stackexchange.com/a/23676/4683 $\endgroup$
    – David Marx
    Mar 23, 2018 at 10:18

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.