-
Notifications
You must be signed in to change notification settings - Fork 8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
EfficientNet | Implementation ? #3380
Comments
+1 |
Paper: https://arxiv.org/abs/1905.11946v2 Classifier
While (Official) EfficientNetB0 (224x224) 0.78 BFLOPS - 0.39 FMA, 5.3M params - that is trained by official code https://github.com/tensorflow/tpu/tree/master/models/official/efficientnet with batch size equals to 256 has lower accuracy: 70.0% Top1 and 88.9% Top5 Detector - 3.7 BFLOPs, 45.0 mAP@0.5 on COCO test-dev.
efficientnet-lite3-leaky.cfg: top-1 73.0%, top-5 92.4%. - change relu6 to leaky: Classifiers: - Can be trained on ImageNet(ILSVRC2012) by using 4 x GPU 2080 TI:
Training command: Continue training: Content of
Dataset - each image in
More: http://www.image-net.org/challenges/LSVRC/2012/nonpub-downloads
CLICK ME - EfficientNet B0 model details#alpha=1.2, beta=1.1, gamma=1.15
#d=pow(alpha, fi), w=pow(beta, fi), r=pow(gamma, fi)
#fi=0, d=1.0, w=1.0, r=1.0 - theoretically
# in practice: https://github.com/tensorflow/tpu/blob/05f7b15cdf0ae36bac84beb4aef0a09983ce8f66/models/official/efficientnet/efficientnet_builder.py#L28-L40
# 'efficientnet-b0': (1.0, 1.0, 224, 0.2):
# width=1.0, depth=1.0, resolution=224, dropout=0.2
BLOCKS 1 - 7:
'r1_k3_s11_e1_i32_o16_se0.25', 'r2_k3_s22_e6_i16_o24_se0.25',
'r2_k5_s22_e6_i24_o40_se0.25', 'r3_k3_s22_e6_i40_o80_se0.25',
'r3_k5_s11_e6_i80_o112_se0.25', 'r4_k5_s22_e6_i112_o192_se0.25',
'r1_k3_s11_e6_i192_o320_se0.25',
In details: https://github.com/tensorflow/tpu/blob/05f7b15cdf0ae36bac84beb4aef0a09983ce8f66/models/official/efficientnet/efficientnet_builder.py#L61-L69
BLOCK-1
# r1_k3_s11_e1_i32_o16_se0.25
# return efficientnet_model.BlockArgs(
# kernel_size=int(options['k']), kernel_size = 3
# num_repeat=int(options['r']), num_repeat = 1
# input_filters=int(options['i']), input_filters = 32
# output_filters=int(options['o']), output_filters = 16
# expand_ratio=int(options['e']), expand_ratio = 1
# id_skip=('noskip' not in block_string),
# se_ratio=float(options['se']) if 'se' in options else None, se_ratio = 0.25
# strides=[int(options['s'][0]), int(options['s'][1])]) strides = 1,1
BLOCK-2
# r2_k3_s22_e6_i16_o24_se0.25
# return efficientnet_model.BlockArgs(
# kernel_size=int(options['k']), kernel_size = 3
# num_repeat=int(options['r']), num_repeat = 2
# input_filters=int(options['i']), input_filters = 16
# output_filters=int(options['o']), output_filters = 24
# expand_ratio=int(options['e']), expand_ratio = 6
# id_skip=('noskip' not in block_string),
# se_ratio=float(options['se']) if 'se' in options else None, se_ratio = 0.25
# strides=[int(options['s'][0]), int(options['s'][1])]) strides = 2,2
BLOCK-3
# r2_k5_s22_e6_i24_o40_se0.25
# return efficientnet_model.BlockArgs(
# kernel_size=int(options['k']), kernel_size = 5
# num_repeat=int(options['r']), num_repeat = 2
# input_filters=int(options['i']), input_filters = 24
# output_filters=int(options['o']), output_filters = 40
# expand_ratio=int(options['e']), expand_ratio = 6
# id_skip=('noskip' not in block_string),
# se_ratio=float(options['se']) if 'se' in options else None, se_ratio = 0.25
# strides=[int(options['s'][0]), int(options['s'][1])]) strides = 2,2
BLOCK-4
# r3_k3_s22_e6_i40_o80_se0.25
# return efficientnet_model.BlockArgs(
# kernel_size=int(options['k']), kernel_size = 3
# num_repeat=int(options['r']), num_repeat = 3
# input_filters=int(options['i']), input_filters = 40
# output_filters=int(options['o']), output_filters = 80
# expand_ratio=int(options['e']), expand_ratio = 6
# id_skip=('noskip' not in block_string),
# se_ratio=float(options['se']) if 'se' in options else None, se_ratio = 0.25
# strides=[int(options['s'][0]), int(options['s'][1])]) strides = 2,2
BLOCK-5
# r3_k5_s11_e6_i80_o112_se0.25
# return efficientnet_model.BlockArgs(
# kernel_size=int(options['k']), kernel_size = 5
# num_repeat=int(options['r']), num_repeat = 3
# input_filters=int(options['i']), input_filters = 80
# output_filters=int(options['o']), output_filters = 112
# expand_ratio=int(options['e']), expand_ratio = 6
# id_skip=('noskip' not in block_string),
# se_ratio=float(options['se']) if 'se' in options else None, se_ratio = 0.25
# strides=[int(options['s'][0]), int(options['s'][1])]) strides = 1,1
BLOCK-6
# r4_k5_s22_e6_i112_o192_se0.25
# return efficientnet_model.BlockArgs(
# kernel_size=int(options['k']), kernel_size = 5
# num_repeat=int(options['r']), num_repeat = 4
# input_filters=int(options['i']), input_filters = 112
# output_filters=int(options['o']), output_filters = 192
# expand_ratio=int(options['e']), expand_ratio = 6
# id_skip=('noskip' not in block_string),
# se_ratio=float(options['se']) if 'se' in options else None, se_ratio = 0.25
# strides=[int(options['s'][0]), int(options['s'][1])]) strides = 2,2
BLOCK-7
# r1_k3_s11_e6_i192_o320_se0.25
# return efficientnet_model.BlockArgs(
# kernel_size=int(options['k']), kernel_size = 3
# num_repeat=int(options['r']), num_repeat = 1
# input_filters=int(options['i']), input_filters = 192
# output_filters=int(options['o']), output_filters = 320
# expand_ratio=int(options['e']), expand_ratio = 6
# id_skip=('noskip' not in block_string),
# se_ratio=float(options['se']) if 'se' in options else None, se_ratio = 0.25
# strides=[int(options['s'][0]), int(options['s'][1])]) strides = 1,1 CLICK ME - EfficientNet B3 model details#alpha=1.2, beta=1.1, gamma=1.15
#d=pow(alpha, fi), w=pow(beta, fi), r=pow(gamma, fi)
#fi=3, d=1.73, w=1.33, r=1.52 - theoretically
# in practice: https://github.com/tensorflow/tpu/blob/05f7b15cdf0ae36bac84beb4aef0a09983ce8f66/models/official/efficientnet/efficientnet_builder.py#L28-L40
# 'efficientnet-b3': (1.2, 1.4, 300, 0.3):
# width=1.2, depth=1.4, resolution=300 (320), dropout=0.3
# https://github.com/tensorflow/tpu/blob/05f7b15cdf0ae36bac84beb4aef0a09983ce8f66/models/official/efficientnet/efficientnet_model.py#L120-L125
# repeats_new = int(math.ceil(depth * repeats)) ### ceil - Rounds x upward,
# https://github.com/tensorflow/tpu/blob/05f7b15cdf0ae36bac84beb4aef0a09983ce8f66/models/official/efficientnet/efficientnet_builder.py#L134-L137
# width_coefficient=width_coefficient,
# depth_coefficient=depth_coefficient,
# depth_divisor=8,
# min_depth=None)
#
# https://github.com/tensorflow/tpu/blob/05f7b15cdf0ae36bac84beb4aef0a09983ce8f66/models/official/efficientnet/efficientnet_model.py#L101-L117
# multiplier = width_coefficient = 1.2
# divisor = 8
# min_depth = none
# min_depth = divisor = 8
filters = filters * 1.2
new_filters = max(8, (int(filters + 4) // 8) * 8) ## //===floor in this case
if new_filters < 0.9 * filters: new_filters += 8
16 *1.2=19,2
new_filters = max(8, int(19,2+4)//8 * 8) = 16 (>=16)
24 *1.2=28,8
new_filters = max(8, int(28,8+4)//8 * 8) = 32 (>24)
32 *1.2=38,4
new_filters = max(8, int(38,4+4)//8 * 8) = 40 (>32)
40 *1.2=48
new_filters = max(8, int(48+4)//8 * 8) = 48 (>40)
80 *1.2=96
new_filters = max(8, int(96+4)//8 * 8) = 96 (>80)
112 *1.2=134,4
new_filters = max(8, int(134,4+4)//8 * 8) = 136 (>112)
192 *1.2=230,4
new_filters = max(8, int(230,4+4)//8 * 8) = 232 (>192)
320 *1.2=384
new_filters = max(8, int(384+4)//8 * 8) = 384 (>320)
8 *1.2=9,6
new_filters = max(8, int(9,6+4)//8 * 8) = 8 (==8)
64 *1.2=76,8
new_filters = max(8, int(76,8+4)//8 * 8) = 80 (>64)
96 *1.2=115,2
new_filters = max(8, int(115,2+4)//8 * 8) = 112 (>96)
144 *1.2=172,8
new_filters = max(8, int(172,8+4)//8 * 8) = 176 (>144)
384 *1.2=460,8
new_filters = max(8, int(460,8+4)//8 * 8) = 464 (>384)
576 *1.2=691,2
new_filters = max(8, int(691,2+4)//8 * 8) = 688 (>576)
960 *1.2=1152
new_filters = max(8, int(1152+4)//8 * 8) = 1152 (>960)
1280 *1.2=1536
new_filters = max(8, int(1536+4)//8 * 8) = 1536 (>1280)
BLOCKS 1 - 7: (for b0)
'r2_k3_s11_e1_i32_o16_se0.25', 'r4_k3_s22_e6_i16_o24_se0.25',
'r4_k5_s22_e6_i24_o40_se0.25', 'r6_k3_s22_e6_i40_o80_se0.25',
'r6_k5_s11_e6_i80_o112_se0.25', 'r8_k5_s22_e6_i112_o192_se0.25',
'r2_k3_s11_e6_i192_o320_se0.25',
In details: https://github.com/tensorflow/tpu/blob/05f7b15cdf0ae36bac84beb4aef0a09983ce8f66/models/official/efficientnet/efficientnet_builder.py#L61-L69
BLOCK-1
# r1_k3_s11_e1_i32_o16_se0.25
# return efficientnet_model.BlockArgs(
# kernel_size=int(options['k']), kernel_size = 3
# num_repeat=int(options['r']), num_repeat = 2 //1
# input_filters=int(options['i']), input_filters = 40 //32
# output_filters=int(options['o']), output_filters = 16 //16
# expand_ratio=int(options['e']), expand_ratio = 1
# id_skip=('noskip' not in block_string),
# se_ratio=float(options['se']) if 'se' in options else None, se_ratio = 0.25
# strides=[int(options['s'][0]), int(options['s'][1])]) strides = 1,1
BLOCK-2
# r2_k3_s22_e6_i16_o24_se0.25
# return efficientnet_model.BlockArgs(
# kernel_size=int(options['k']), kernel_size = 3
# num_repeat=int(options['r']), num_repeat = 3 //2
# input_filters=int(options['i']), input_filters = 16 //16
# output_filters=int(options['o']), output_filters = 32 //24
# expand_ratio=int(options['e']), expand_ratio = 6
# id_skip=('noskip' not in block_string),
# se_ratio=float(options['se']) if 'se' in options else None, se_ratio = 0.25
# strides=[int(options['s'][0]), int(options['s'][1])]) strides = 2,2
BLOCK-3
# r2_k5_s22_e6_i24_o40_se0.25
# return efficientnet_model.BlockArgs(
# kernel_size=int(options['k']), kernel_size = 5
# num_repeat=int(options['r']), num_repeat = 3 //2
# input_filters=int(options['i']), input_filters = 32 //24
# output_filters=int(options['o']), output_filters = 48 //40
# expand_ratio=int(options['e']), expand_ratio = 6
# id_skip=('noskip' not in block_string),
# se_ratio=float(options['se']) if 'se' in options else None, se_ratio = 0.25
# strides=[int(options['s'][0]), int(options['s'][1])]) strides = 2,2
BLOCK-4
# r3_k3_s22_e6_i40_o80_se0.25
# return efficientnet_model.BlockArgs(
# kernel_size=int(options['k']), kernel_size = 3
# num_repeat=int(options['r']), num_repeat = 5 //3
# input_filters=int(options['i']), input_filters = 48 //40
# output_filters=int(options['o']), output_filters = 96 //80
# expand_ratio=int(options['e']), expand_ratio = 6
# id_skip=('noskip' not in block_string),
# se_ratio=float(options['se']) if 'se' in options else None, se_ratio = 0.25
# strides=[int(options['s'][0]), int(options['s'][1])]) strides = 2,2
BLOCK-5
# r3_k5_s11_e6_i80_o112_se0.25
# return efficientnet_model.BlockArgs(
# kernel_size=int(options['k']), kernel_size = 5
# num_repeat=int(options['r']), num_repeat = 5 //3
# input_filters=int(options['i']), input_filters = 96 //80
# output_filters=int(options['o']), output_filters = 136 //112
# expand_ratio=int(options['e']), expand_ratio = 6
# id_skip=('noskip' not in block_string),
# se_ratio=float(options['se']) if 'se' in options else None, se_ratio = 0.25
# strides=[int(options['s'][0]), int(options['s'][1])]) strides = 1,1
BLOCK-6
# r4_k5_s22_e6_i112_o192_se0.25
# return efficientnet_model.BlockArgs(
# kernel_size=int(options['k']), kernel_size = 5
# num_repeat=int(options['r']), num_repeat = 6 //4
# input_filters=int(options['i']), input_filters = 136 //112
# output_filters=int(options['o']), output_filters = 232 //192
# expand_ratio=int(options['e']), expand_ratio = 6
# id_skip=('noskip' not in block_string),
# se_ratio=float(options['se']) if 'se' in options else None, se_ratio = 0.25
# strides=[int(options['s'][0]), int(options['s'][1])]) strides = 2,2
BLOCK-7
# r1_k3_s11_e6_i192_o320_se0.25
# return efficientnet_model.BlockArgs(
# kernel_size=int(options['k']), kernel_size = 3
# num_repeat=int(options['r']), num_repeat = 2 //1
# input_filters=int(options['i']), input_filters = 232 //192
# output_filters=int(options['o']), output_filters = 384 //320
# expand_ratio=int(options['e']), expand_ratio = 6
# id_skip=('noskip' not in block_string),
# se_ratio=float(options['se']) if 'se' in options else None, se_ratio = 0.25
# strides=[int(options['s'][0]), int(options['s'][1])]) strides = 1,1 CLICK ME - EfficientNet B4 model details#alpha=1.2, beta=1.1, gamma=1.15
#d=pow(alpha, fi), w=pow(beta, fi), r=pow(gamma, fi)
#fi=4, d=2.07, w=1.46, r=1.75 - theoretically
# in practice: https://github.com/tensorflow/tpu/blob/05f7b15cdf0ae36bac84beb4aef0a09983ce8f66/models/official/efficientnet/efficientnet_builder.py#L28-L40
# efficientnet-b4': (1.4, 1.8, 380, 0.4):
# width=1.4, depth=1.8, resolution=380, dropout=0.4
# https://github.com/tensorflow/tpu/blob/05f7b15cdf0ae36bac84beb4aef0a09983ce8f66/models/official/efficientnet/efficientnet_model.py#L120-L125
# repeats_new = int(math.ceil(depth * repeats)) ### ceil - Rounds x upward,
# https://github.com/tensorflow/tpu/blob/05f7b15cdf0ae36bac84beb4aef0a09983ce8f66/models/official/efficientnet/efficientnet_builder.py#L134-L137
# width_coefficient=width_coefficient,
# depth_coefficient=depth_coefficient,
# depth_divisor=8,
# min_depth=None)
#
# https://github.com/tensorflow/tpu/blob/05f7b15cdf0ae36bac84beb4aef0a09983ce8f66/models/official/efficientnet/efficientnet_model.py#L101-L117
# multiplier = width_coefficient = 1.4
# divisor = 8
# min_depth = none
# min_depth = divisor = 8
filters = filters * 1.4
new_filters = max(8, (int(filters + 4) // 8) * 8) ## //===floor in this case
if new_filters < 0.9 * filters: new_filters += 8
16 *1.4=22.4
new_filters = max(8, int(22.4+4)//8 * 8) = 24 (>16)
24 *1.4=33.6
new_filters = max(8, int(33.6+4)//8 * 8) = 32 (>24)
32 *1.4=44.8
new_filters = max(8, int(44.8+4)//8 * 8) = 48 (>32)
40 *1.4=56
new_filters = max(8, int(56+4)//8 * 8) = 56 (>40)
80 *1.4=112
new_filters = max(8, int(112+4)//8 * 8) = 112 (>80)
112 *1.4=156,8
new_filters = max(8, int(156,8+4)//8 * 8) = 160 (>112)
192 *1.4=268,8
new_filters = max(8, int(268,8+4)//8 * 8) = 272 (>192)
320 *1.4=448
new_filters = max(8, int(448+4)//8 * 8) = 448 (>320)
8 *1.4=11,2
new_filters = max(8, int(11,2+4)//8 * 8) = 8 (==8)
64 *1.4=89,6
new_filters = max(8, int(89,6+4)//8 * 8) = 88 (>64)
96 *1.4=134,4
new_filters = max(8, int(134,4+4)//8 * 8) = 136 (>96)
144 *1.4=201,6
new_filters = max(8, int(201,6+4)//8 * 8) = 200 (>144)
384 *1.4=537,6
new_filters = max(8, int(537,6+4)//8 * 8) = 536 (>384)
576 *1.4=806,4
new_filters = max(8, int(806,4+4)//8 * 8) = 808 (>576)
960 *1.4=1344
new_filters = max(8, int(1344+4)//8 * 8) = 1344 (>960)
1280 *1.4=1792
new_filters = max(8, int(1792+4)//8 * 8) = 1792 (>1280)
BLOCKS 1 - 7:
'r2_k3_s11_e1_i32_o16_se0.25', 'r4_k3_s22_e6_i16_o24_se0.25',
'r4_k5_s22_e6_i24_o40_se0.25', 'r6_k3_s22_e6_i40_o80_se0.25',
'r6_k5_s11_e6_i80_o112_se0.25', 'r8_k5_s22_e6_i112_o192_se0.25',
'r2_k3_s11_e6_i192_o320_se0.25',
In details: https://github.com/tensorflow/tpu/blob/05f7b15cdf0ae36bac84beb4aef0a09983ce8f66/models/official/efficientnet/efficientnet_builder.py#L61-L69
BLOCK-1
# r1_k3_s11_e1_i32_o16_se0.25
# return efficientnet_model.BlockArgs(
# kernel_size=int(options['k']), kernel_size = 3
# num_repeat=int(options['r']), num_repeat = 2 //1
# input_filters=int(options['i']), input_filters = 48 //32
# output_filters=int(options['o']), output_filters = 24 //16
# expand_ratio=int(options['e']), expand_ratio = 1
# id_skip=('noskip' not in block_string),
# se_ratio=float(options['se']) if 'se' in options else None, se_ratio = 0.25
# strides=[int(options['s'][0]), int(options['s'][1])]) strides = 1,1
BLOCK-2
# r2_k3_s22_e6_i16_o24_se0.25
# return efficientnet_model.BlockArgs(
# kernel_size=int(options['k']), kernel_size = 3
# num_repeat=int(options['r']), num_repeat = 4 //2
# input_filters=int(options['i']), input_filters = 24 //16
# output_filters=int(options['o']), output_filters = 32 //24
# expand_ratio=int(options['e']), expand_ratio = 6
# id_skip=('noskip' not in block_string),
# se_ratio=float(options['se']) if 'se' in options else None, se_ratio = 0.25
# strides=[int(options['s'][0]), int(options['s'][1])]) strides = 2,2
BLOCK-3
# r2_k5_s22_e6_i24_o40_se0.25
# return efficientnet_model.BlockArgs(
# kernel_size=int(options['k']), kernel_size = 5
# num_repeat=int(options['r']), num_repeat = 4 //2
# input_filters=int(options['i']), input_filters = 32 //24
# output_filters=int(options['o']), output_filters = 56 //40
# expand_ratio=int(options['e']), expand_ratio = 6
# id_skip=('noskip' not in block_string),
# se_ratio=float(options['se']) if 'se' in options else None, se_ratio = 0.25
# strides=[int(options['s'][0]), int(options['s'][1])]) strides = 2,2
BLOCK-4
# r3_k3_s22_e6_i40_o80_se0.25
# return efficientnet_model.BlockArgs(
# kernel_size=int(options['k']), kernel_size = 3
# num_repeat=int(options['r']), num_repeat = 6 //3
# input_filters=int(options['i']), input_filters = 56 //40
# output_filters=int(options['o']), output_filters = 112 //80
# expand_ratio=int(options['e']), expand_ratio = 6
# id_skip=('noskip' not in block_string),
# se_ratio=float(options['se']) if 'se' in options else None, se_ratio = 0.25
# strides=[int(options['s'][0]), int(options['s'][1])]) strides = 2,2
BLOCK-5
# r3_k5_s11_e6_i80_o112_se0.25
# return efficientnet_model.BlockArgs(
# kernel_size=int(options['k']), kernel_size = 5
# num_repeat=int(options['r']), num_repeat = 6 //3
# input_filters=int(options['i']), input_filters = 112 //80
# output_filters=int(options['o']), output_filters = 160 //112
# expand_ratio=int(options['e']), expand_ratio = 6
# id_skip=('noskip' not in block_string),
# se_ratio=float(options['se']) if 'se' in options else None, se_ratio = 0.25
# strides=[int(options['s'][0]), int(options['s'][1])]) strides = 1,1
BLOCK-6
# r4_k5_s22_e6_i112_o192_se0.25
# return efficientnet_model.BlockArgs(
# kernel_size=int(options['k']), kernel_size = 5
# num_repeat=int(options['r']), num_repeat = 8 //4
# input_filters=int(options['i']), input_filters = 160 //112
# output_filters=int(options['o']), output_filters = 272 //192
# expand_ratio=int(options['e']), expand_ratio = 6
# id_skip=('noskip' not in block_string),
# se_ratio=float(options['se']) if 'se' in options else None, se_ratio = 0.25
# strides=[int(options['s'][0]), int(options['s'][1])]) strides = 2,2
BLOCK-7
# r1_k3_s11_e6_i192_o320_se0.25
# return efficientnet_model.BlockArgs(
# kernel_size=int(options['k']), kernel_size = 3
# num_repeat=int(options['r']), num_repeat = 2 //1
# input_filters=int(options['i']), input_filters = 272 //192
# output_filters=int(options['o']), output_filters = 448 //320
# expand_ratio=int(options['e']), expand_ratio = 6
# id_skip=('noskip' not in block_string),
# se_ratio=float(options['se']) if 'se' in options else None, se_ratio = 0.25
# strides=[int(options['s'][0]), int(options['s'][1])]) strides = 1,1
In other words, to scale up the CNN, the depth of layers should increase 20%, the width 10% and the image resolution 15% to keep things as efficient as possible while expanding the implementation and improving the CNN accuracy. The MBConv block is nothing fancy but an Inverted Residual Block (used in MobileNetV2) with a Squeeze and Excite block injected sometimes.
MobileNet_v2: EfficientNet_b0: |
This comment has been minimized.
This comment has been minimized.
Would like to share this link. https://pypi.org/project/gluoncv2/ Interesting to see the imagenet-1k comparison chart. Model | Top 1 Error | Top 5 Error | Params | Flops With the difference of 2% in top 1 error with number of parameters are 1/8 and 1/17 less flops. Also a tiny version wouldn't be bad after all. |
@dexception |
This comment has been minimized.
This comment has been minimized.
Keras, Pytorch and Mxnet implementation is definitely there: The code and research paper is different. But the code is correct. I don't think there is any caffe implementation as of yet. |
Hello, I draw the model from Keras implementation: https://github.com/qubvel/efficientnet . I use the code: model = EfficientNetB1() |
Maybe squeeze and excitation blocks are missing? |
@WongKinYiu Thanks! Can you also add model diagram for B4?
I think yes, there should be:
|
@dexception Thanks! |
Model diagram for EfficientNets. |
@WongKinYiu Thanks! It seems now it looks like your diagram:
Should be used: should be trained at least 1.6 M iterations with Trained weights-file, 500 000 iterations with batch=120: https://drive.google.com/open?id=1MvX0skcmg87T_jn8kDf2Oc6raIb56xq9 Just
On your diagrams Lambda is a [avgpool]. MBConv blocks includes:
|
@AlexeyAB Good job! And thank you for sharing the cfg file. I will also implement SNet of ThunderNet as backbone to compare with EfficientNet. |
@WongKinYiu Yes, this is interesting that SNet+ThunderNet achieved the same accuracy 78.6% mAP@0.5 as Yolo v2, but by using 2-stage-detector with 24 FPS on ARM CPU: https://paperswithcode.com/sota/object-detection-on-pascal-voc-2007 |
@AlexeyAB I also want to implement CEM (Context Enhancement Module) and SAM (Spatial Attention Module) of ThunderNet. CEM + YOLOv3 got 41.2% mAP@0.5 with 2.85 BFLOPs. |
I'd be interested in running a trial with efficientnet and sharing the results - do you have a B6 or B7 version of the model? Do I use it in the same way as I would with any of the other cfg files? No need to manually calculate anchors and enter classes in the cfg? |
Oh I see - efficientnet is a full Object Detector? But maybe the B7 model with a Yolo head... ? |
@LukeAI |
Ok so I realise that this is image classification - I have an image classification problem with 7 classes - if necessary I could resize all my images to 32x32 - how could I train/test on my dataset with the .cfg ? |
@AlexeyAB |
|
this paper might be relevant with this issue in detection task |
@syjeon121 Thanks! I added a separate issue: #4346 |
@AlexeyAB Q2. I would like to know which is the most efficient architecture that doesn't use depthwise-convoltion ? Also, If we set the criteria for Min Top 1 Accuracy to 75% MobileNetV3 L/224/1.0 vs Mixnet-S |
What is the offline usage ?
As I understand it, these are very close architectures. Yes, according to https://pypi.org/project/gluoncv2/
|
Is there a darknet implementation of MobileNetV3? |
By offline usage i meant user can wait for the output even if it is a little late and where accuracy is more important and we can use heavy models for detection. Can you share which architecture is the most efficient if we don't include any that use depthwise-convolution with min top 1 accuracy 75% ? |
@LukeAI No.
With small mini_batch size instead of
So:
More: #4406 |
@AlexeyAB @WongKinYiu |
@AlexeyAB @WongKinYiu |
While And since GhostNet there isn't implemented yet. There are
Now @WongKinYiu is training Or you can try to train with CutMix and Large mini-batch size https://github.com/WongKinYiu/CrossStagePartialNetworks#big-models
For example, you can try to train https://github.com/AlexeyAB/darknet/files/3838329/mixnet_m.cfg.txt
|
@AlexeyAB |
This paper might also Help a Bit: https://arxiv.org/pdf/1904.11486 |
@AlexeyAB Hi, about enet-coco.cfg |
@AlexeyAB Hi, in |
@AlexeyAB @WongKinYiu enet-coco.cfg is very slow during training than yolov4.cfg. I am running both models in google colab. why is that? I have seen the enet-coco model have very small BFLoPs than yolov4. |
@Fetulhak It is because FLOPs usually doesn't mean anything for the most of devices mobile (GPU, NPU, APU, DSP), Embedded (Jetson), mid/high-end GPUs (RTX 3070, A100....) FLOPs says about computations cost, but it doesn't say anything about the possibility of parallelization and the need for memory bandwidth, while weak parallelization and high memory bandwidth requirements can slow down the speed many times. For example, EfficientDetD3 has 2.4x times less Flops but 2x times slower:
|
@AlexeyAB is it because of their network architecture difference (enet-coco and yolov4), the possibility of parallelization and the need for memory bandwidth is going to be varied? Because I am using the same GPU to train both models. |
@Fetulhak Yes, it is because of their network architecture difference. EfficientNet uses:
|
https://github.com/tensorflow/tpu/tree/master/models/official/efficientnet
https://ai.googleblog.com/2019/05/efficientnet-improving-accuracy-and.html
https://www.youtube.com/watch?v=3svIm5UC94I
This is good.
The text was updated successfully, but these errors were encountered: