Skip to content

Compare tensorflow and dlib models #3002

Answered by arrufat
UlrichVonRekkenin asked this question in Q&A
Discussion options

You must be logged in to vote

Anyway, after further inspection, you got the kernel sizes for convolutions and max pooling layers wrong.
Here's my attempt:

#include <dlib/dnn.h>

namespace dnn
{
    using namespace dlib;

    template <long num_filters, long ks, int s, typename SUBNET>
    using conp = add_layer<con_<num_filters, ks, ks, s, s, (ks - 1) / 2, (ks - 1) / 2>, SUBNET>;

    template <size_t NUMS, typename SUBNET>
    using layer = max_pool<2, 2, 2, 2, relu<conp<NUMS, 3, 1, SUBNET>>>;

    using netType = loss_binary_log<fc<1, relu<fc<512, layer<128, layer<64, layer<32, input<matrix<unsigned char>>>>>>>>>;
}

auto main() -> int
{
    dnn::netType net;
    dlib::matrix<unsigned char> image(26, 34);
    net(im…

Replies: 2 comments 21 replies

Comment options

You must be logged in to vote
20 replies
@arrufat
Comment options

@UlrichVonRekkenin
Comment options

@arrufat
Comment options

@arrufat
Comment options

Answer selected by UlrichVonRekkenin
@UlrichVonRekkenin
Comment options

@arrufat
Comment options

@UlrichVonRekkenin
Comment options

@arrufat
Comment options

Comment options

You must be logged in to vote
1 reply
@arrufat
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants