1 //
2 //  ResNetExpr.hpp
3 //  MNN
4 //  Reference paper: https://arxiv.org/pdf/1512.03385.pdf
5 //
6 //  Created by MNN on 2019/06/25.
7 //  Copyright © 2018, Alibaba Group Holding Limited
8 //
9 
10 #ifndef ResNetExpr_hpp
11 #define ResNetExpr_hpp
12 
13 #include <map>
14 #include <string>
15 #include <MNN/expr/Expr.hpp>
16 
17 enum ResNetType {
18     ResNet18, ResNet34, ResNet50, ResNet101, ResNet152
19 };
20 
EnumResNetTypeByString(const std::string & key)21 static inline ResNetType EnumResNetTypeByString(const std::string& key) {
22     auto resNetTypeMap = std::map<std::string, ResNetType>({
23         {"18", ResNet18},
24         {"34", ResNet34},
25         {"50", ResNet50},
26         {"101", ResNet101},
27         {"152", ResNet152}});
28     auto resNetTypeIter = resNetTypeMap.find(key);
29     if (resNetTypeIter == resNetTypeMap.end()) {
30         return (ResNetType)(-1);
31     }
32     return resNetTypeIter->second;
33 }
34 
35 MNN::Express::VARP resNetExpr(ResNetType resNetType, int numClass);
36 
37 #endif //ResNetExpr_hpp
38