This is a very interesting supervision but hard to achieve!
Why we need this supervision?
The need for this supervision comes from the fact that model may wrongly detect more objects than it should, thus, must be punished (taught) for this violation, otherwise no supervision would be required since model is acting accordingly.
How to implement this supervision?
To this end, we need to fork some layers from the model to output the number of detected objects per class $c$ for input image $i$, namely $n'_{c,i}$, then supervise this output with the true number of objects in image $i$, namely $n_{c, i}$, or merely with an upper limit $N_c$ per class as you have suggested. Then, add a term like $(n_{c, i} - n'_{c, i})^2$ or $\text{max}(0, n'_{c, i} - N_c)$ to the loss function to punish the model for detecting wrong or more number of objects than it should respectively. Then proceed to train the model.
What may go wrong?
But here is the problem, model can learn to lie about the number of detected objects through modifying the forked layers (weights)! Since it is easier for model to fabricate a valid $n'_{c, i}$ than to actually detect fewer objects which is more complex. Also, if we use a constant, unfabricatable unit (e.g. a constant neural net) that counts the number of detected objects, there would be no gradient to punish (teach) the model!
This is why this type of supervision is hard to achieve.