Introduction
EfficientNet scaling helps build better image recognition models by smartly making the model bigger in three ways: deeper, wider, and higher resolution, without wasting effort.
Jump into concepts and practice - no test required
def efficientnet_scaling(base_depth, base_width, base_resolution, phi, alpha=1.2, beta=1.1, gamma=1.15): depth = int(base_depth * (alpha ** phi)) width = int(base_width * (beta ** phi)) resolution = int(base_resolution * (gamma ** phi)) return depth, width, resolution
depth, width, resolution = efficientnet_scaling(10, 64, 224, phi=1) print(depth, width, resolution)
depth, width, resolution = efficientnet_scaling(10, 64, 224, phi=2) print(depth, width, resolution)
depth, width, resolution = efficientnet_scaling(10, 64, 224, phi=0) print(depth, width, resolution)
def efficientnet_scaling(base_depth, base_width, base_resolution, phi, alpha=1.2, beta=1.1, gamma=1.15): depth = int(base_depth * (alpha ** phi)) width = int(base_width * (beta ** phi)) resolution = int(base_resolution * (gamma ** phi)) return depth, width, resolution # Base model parameters base_depth = 10 base_width = 64 base_resolution = 224 # Scale model with phi=2 phi = 2 scaled_depth, scaled_width, scaled_resolution = efficientnet_scaling(base_depth, base_width, base_resolution, phi) print(f"Scaled Depth: {scaled_depth}") print(f"Scaled Width: {scaled_width}") print(f"Scaled Resolution: {scaled_resolution}")
alpha, beta, gamma, phi = 1.2, 1.1, 1.15, 2 depth = alpha * phi width = beta ** phi resolution = gamma ** phi