dlib icon indicating copy to clipboard operation
dlib copied to clipboard

Unable to convert dat to caffe

Open brlcad opened this issue 3 years ago • 5 comments

Hi, I'm attempting to convert one of the sample vehicle detection models to caffe and am running into an issue.

Expected Behavior

I was expecting to run the dtoc program on mmod_front_and_rear_end_vehicle_detector.xml (generated by calling dlib::net_to_xml(net, "mmod_front_and_rear_end_vehicle_detector.xml")) and get a Caffe conversion.

Current Behavior

Instead, I get the following error:

~/src/dlib/tools/convert_dlib_nets_to_caffe/.build/dtoc mmod_front_and_rear_end_vehicle_detector.xml 1 1 928 478
Writing python part of model to mmod_front_and_rear_end_vehicle_detector_dlib_to_caffe_model.py
Writing weights part of model to mmod_front_and_rear_end_vehicle_detector_dlib_to_caffe_model.weights


*************** ERROR CONVERTING TO CAFFE ***************
string cast error: invalid string = 'true'

Steps to Reproduce

Steps shown above. I simply compiled dtoc, called net_to_xml(), ran dtoc on resulting xml, and got an erro (no ou

  • Version:

19.24.99

  • Where did you get dlib: github repo

  • Platform: Mac

  • Compiler: Apple clang version 13.0.0 (clang-1300.0.29.30)

brlcad avatar May 31 '22 08:05 brlcad

That model isn't convertible to something caffe could understand.

On Tue, May 31, 2022 at 4:18 AM Christopher Sean Morrison < @.***> wrote:

Hi, I'm attempting to convert one of the sample vehicle detection models to caffe and am running into an issue. Expected Behavior

I was expecting to run the dtoc program on mmod_front_and_rear_end_vehicle_detector.xml (generated by calling dlib::net_to_xml(net, "mmod_front_and_rear_end_vehicle_detector.xml")) and get a Caffe conversion. Current Behavior

Instead, I get the following error:

~/src/dlib/tools/convert_dlib_nets_to_caffe/.build/dtoc mmod_front_and_rear_end_vehicle_detector.xml 1 1 928 478 Writing python part of model to mmod_front_and_rear_end_vehicle_detector_dlib_to_caffe_model.py Writing weights part of model to mmod_front_and_rear_end_vehicle_detector_dlib_to_caffe_model.weights

*************** ERROR CONVERTING TO CAFFE *************** string cast error: invalid string = 'true'

Steps to Reproduce

Steps shown above. I simply compiled dtoc, called net_to_xml(), ran dtoc on resulting xml, and got an erro (no ou

  • Version:

19.24.99

Where did you get dlib: github repo

Platform: Mac

Compiler: Apple clang version 13.0.0 (clang-1300.0.29.30)

— Reply to this email directly, view it on GitHub https://github.com/davisking/dlib/issues/2592, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABPYFR6YHN6YPY64ABPDXETVMXDMXANCNFSM5XMV5SNA . You are receiving this because you are subscribed to this thread.Message ID: @.***>

davisking avatar Jun 01 '22 12:06 davisking

Warning: this issue has been inactive for 35 days and will be automatically closed on 2022-07-16 if there is no further activity.

If you are waiting for a response but haven't received one it's possible your question is somehow inappropriate. E.g. it is off topic, you didn't follow the issue submission instructions, or your question is easily answerable by reading the FAQ, dlib's official compilation instructions, dlib's API documentation, or a Google search.

dlib-issue-bot avatar Jul 07 '22 08:07 dlib-issue-bot

Warning: this issue has been inactive for 42 days and will be automatically closed on 2022-07-16 if there is no further activity.

If you are waiting for a response but haven't received one it's possible your question is somehow inappropriate. E.g. it is off topic, you didn't follow the issue submission instructions, or your question is easily answerable by reading the FAQ, dlib's official compilation instructions, dlib's API documentation, or a Google search.

dlib-issue-bot avatar Jul 14 '22 08:07 dlib-issue-bot

I'm not sure I understand the terse response. The model clearly didn't convert (i.e., isn't convertible). Is the input simply unsupported presently or is it outright an invalid input that cannot possibly convert?

brlcad avatar Jul 16 '22 04:07 brlcad

In my humble opinion, there are two key aspects unique to dlib in that network:

  • the input layer: input_rgb_image_pyramid
    • this layer creates a tiled pyramid of the input image which, as far as I know, it's not supported anywhere else
  • the loss layer: loss_mmod
    • this loss layer is also unique to dlib, no equivalent in other machine learning frameworks exists.

As for the rest of the network, it's just a bunch of the standard convolution + batch norm + relu blocks, so nothing special there.

Therefore, unless you write those layers on caffe, there's no way that network would work. I'd suggest you read about this blog post, which explains it in more detail.

arrufat avatar Jul 16 '22 04:07 arrufat

Warning: this issue has been inactive for 35 days and will be automatically closed on 2022-08-30 if there is no further activity.

If you are waiting for a response but haven't received one it's possible your question is somehow inappropriate. E.g. it is off topic, you didn't follow the issue submission instructions, or your question is easily answerable by reading the FAQ, dlib's official compilation instructions, dlib's API documentation, or a Google search.

dlib-issue-bot avatar Aug 20 '22 08:08 dlib-issue-bot

Warning: this issue has been inactive for 42 days and will be automatically closed on 2022-08-30 if there is no further activity.

If you are waiting for a response but haven't received one it's possible your question is somehow inappropriate. E.g. it is off topic, you didn't follow the issue submission instructions, or your question is easily answerable by reading the FAQ, dlib's official compilation instructions, dlib's API documentation, or a Google search.

dlib-issue-bot avatar Aug 27 '22 08:08 dlib-issue-bot

Thank you for the responses. The gist I'm understanding is that the dtoc tool cannot support any dlib network via xml, but only certain ones. Thus the syntax error in my report is really an indication that should have simply reported back as "unsupported" or even "unsupportable" (though I don't know if that's strictly true). Thanks for the responses received.

brlcad avatar Aug 29 '22 04:08 brlcad