generated from dlibml/dlib-template-project
-
Notifications
You must be signed in to change notification settings - Fork 2
/
alexnet.h
30 lines (25 loc) · 1.04 KB
/
alexnet.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
#ifndef AlexNet_H
#define AlexNet_H
#include <dlib/dnn.h>
namespace alexnet
{
// clang-format off
using namespace dlib;
template <template <typename> class ACT, template <typename> class DO>
struct def
{
template <long num_filters, long ks, int s, int p, typename SUBNET>
using conp = add_layer<con_<num_filters, ks, ks, s, s, p, p>, SUBNET>;
template <typename INPUT>
using backbone = fc<1000, ACT<fc<4096, DO<ACT<fc<4096, DO<
max_pool<3, 3, 2, 2, ACT<conp<256, 3, 1, 1,
ACT<conp<384, 3, 1, 1, ACT<conp<384, 3, 1, 1,
max_pool<3, 3, 2, 2, ACT<conp<256, 5, 1, 2,
max_pool<3, 3, 2, 2, ACT<conp<96, 11, 4, 2,
INPUT>>>>>>>>>>>>>>>>>>>>;
};
using train = loss_multiclass_log<def<relu, dropout>::backbone<input_rgb_image>>;
using infer = loss_multiclass_log<def<relu, multiply>::backbone<input_rgb_image>>;
// clang-format on
} // namespace alexnet
#endif // AlexNet_H