NUM=-1 is a small efficientnet for small people
MODIFY
examples/benchmark_train_efficientnet.py
examples/benchmark_train_efficientnet.py
@@ -29,7 +29,7 @@ if __name__ == "__main__":
print(f"NUM:{NUM} BS:{BS} CNT:{CNT}")
model = EfficientNet(NUM, classes=1000, has_se=False, track_running_stats=False)
parameters = get_parameters(model)
- optimizer = optim.Adam(parameters, lr=0.001)
+ optimizer = optim.SGD(parameters, lr=0.001)
Tensor.training = True
for i in trange(CNT):

MODIFY
models/efficientnet.py
models/efficientnet.py
@@ -66,7 +66,7 @@ class EfficientNet:
(2.0, 3.1), # b7
(2.2, 3.6), # b8
(4.3, 5.3), # l2
- ][number]
+ ][max(number,0)]
def round_filters(filters):
multiplier = global_params[0]
@@ -93,6 +93,14 @@ class EfficientNet:
[1, 3, (1,1), 6, 192, 320, 0.25],
]
+ if self.number == -1:
+ blocks_args = [
+ [1, 3, (2,2), 1, 32, 40, 0.25],
+ [1, 3, (2,2), 1, 40, 80, 0.25],
+ [1, 3, (2,2), 1, 80, 192, 0.25],
+ [1, 3, (2,2), 1, 192, 320, 0.25],
+ ]
+
self._blocks = []
for num_repeats, kernel_size, strides, expand_ratio, input_filters, output_filters, se_ratio in blocks_args:
input_filters, output_filters = round_filters(input_filters), round_filters(output_filters)

NUM=-1 is a small efficientnet for small people