I have a large dataset (over 100k samples) of vehicles with the ground truth of their lengths.

Is it possible to train a deep network to measure/estimate vehicle length?

I haven't seen any papers related to estimating object size using a deep neural network.

  • 1
    $\begingroup$ Is your data set images or text? hisairnessag3 is on the right track with porting the pixels/metric approach from OpenCV to an object detection DNN $\endgroup$
    – Adnan S
    Commented Oct 20, 2017 at 19:45

3 Answers 3


Yes! This most certainly can be done. Since you have a labeled dataset, that makes it all the more simple!

I would take a look at this project and that should get you where you need to go.

The implementation details should be pretty straightforward. Let me know if I can help further.

  • 1
    $\begingroup$ It is not necessary to explain why someone is down voting. Many programmers do not have enough time to look at the comments, they look at the votes to see if the answer worth it or not. If you read the question again, you will find that the question is specifically about using DNN and not anything else. the project you shared is about using Opencv ... if you read the comments under the post you shared, you will find that people are asking about DNN, but the post itself does not use DNN. By the way I am not the person who down voted your answer $\endgroup$
    – BH85
    Commented Oct 19, 2017 at 23:03
  • 2
    $\begingroup$ It isn't necessary but is helpful. If you search at any depth you will find no projects or papers on this particular use case for DNNs. With that being said, I referenced the closest possible project in the hopes of getting OP started. Additionally, I answered the question. The question was can this be done. $\endgroup$ Commented Oct 19, 2017 at 23:08
  • $\begingroup$ Thanks for your answer! I think it would be improved by a little explanation of how/why it's possible. At least an outline of the architecture would be very helpful. $\endgroup$
    – Ben N
    Commented Oct 20, 2017 at 22:16

I think this paper can help you out: 3D Bounding Box Estimation Using Deep Learning and Geometry

He used 1 VGG-19 (pretrained on ImageNet) to learn the size of cars

  • $\begingroup$ Like you, I assumed this is about inferring a 3D bounding box where the data is represented in a 2D image. The project mentioned by hisairnessag3 appears to only address the 2D bounding box with no learned inferential behavior about the 3D nature that the image might contain. $\endgroup$
    – Jim
    Commented Jan 18, 2019 at 22:17
  • $\begingroup$ This paper estimates the size and the orientation of the car using a 2D cropped image (only contain the desired object). $\endgroup$
    – cryax dsa
    Commented Jan 22, 2019 at 3:24

Yes it's possible, but first you'll have to recognize some object in the image, either 1) the vehicle itself, and then report that vehicle's known size, or 2) a known object that's the same distance from the camera as the car (a curb, a stop sign, the driver's head, a shetland pony... whatever), and then use that object to calibrate the size of the car that's very close to it.

Any car in an image will be an unknown distance from the camera, making the car object appear larger or smaller from photo to photo. If you don't recognize the car or at least a referent object that has a known size, the physical size of the car will be uncalibrated -- you'll have no basis for your size estimate.

If the car is unknown, then even if you do have visual clues (there is a referent object present or the distance from camera to car is known), the unknown extent of wide angle-ness of the camera's lens may distort an unknown car's shape (height vs width), further complicating your ability to estimate its apparent dimensions.

  • $\begingroup$ Can the license plate of the vehicle be that known object used to calibrate the size of the car? License plates are typically the same size. $\endgroup$
    – Naji
    Commented Oct 23, 2017 at 19:05
  • 1
    $\begingroup$ You'd have to be careful about the assumptions you make that license plates are the same size. For instance, an Australian plate and US plate are different sizes. If this isn't a problem for your application (it'll only ever run in one country), you could assume a reference size for the plate. You would have to be careful still though, because the plate may not be oriented normally to you. If the car is at 45 degrees, the width of the plate will take up fewer pixels than at 0, even at the same distance. $\endgroup$
    – pshlady
    Commented Nov 20, 2017 at 18:00

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .