Get the final model from the given arguments
(num_filters, num_of_residual_blocks)
| 77 | return out |
| 78 | |
| 79 | def get_edsr_model(num_filters, num_of_residual_blocks): |
| 80 | """ |
| 81 | Get the final model from the given arguments |
| 82 | """ |
| 83 | # Flexible Inputs to input_layer |
| 84 | input_layer = layers.Input(shape=(None, None, 3)) |
| 85 | # Scaling Pixel Values |
| 86 | out = layers.Rescaling(scale=1.0 / 255)(input_layer) |
| 87 | out = x_new = layers.Conv2D(num_filters, 3, padding="same")(out) |
| 88 | |
| 89 | # 16 residual blocks |
| 90 | for _ in range(num_of_residual_blocks): |
| 91 | x_new = resblock(x_new) |
| 92 | |
| 93 | x_new = layers.Conv2D(num_filters, 3, padding="same")(x_new) |
| 94 | out = layers.Add()([out, x_new]) |
| 95 | |
| 96 | out = upsampling(out) |
| 97 | out = layers.Conv2D(3, 3, padding="same")(out) |
| 98 | |
| 99 | output_layer = layers.Rescaling(scale=255)(out) |
| 100 | return EDSRModel(input_layer, output_layer) |
no test coverage detected