google-research
34 строки · 1.1 Кб
1# coding=utf-8
2# Copyright 2024 The Google Research Authors.
3#
4# Licensed under the Apache License, Version 2.0 (the "License");
5# you may not use this file except in compliance with the License.
6# You may obtain a copy of the License at
7#
8# http://www.apache.org/licenses/LICENSE-2.0
9#
10# Unless required by applicable law or agreed to in writing, software
11# distributed under the License is distributed on an "AS IS" BASIS,
12# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13# See the License for the specific language governing permissions and
14# limitations under the License.
15
16"""Models for flare removal."""
17
18from flare_removal.python import u_net
19from flare_removal.python import vgg
20
21
22def build_model(model_type, batch_size):
23"""Returns a Keras model specified by name."""
24if model_type == 'unet':
25return u_net.get_model(
26input_shape=(512, 512, 3),
27scales=4,
28bottleneck_depth=1024,
29bottleneck_layers=2)
30elif model_type == 'can':
31return vgg.build_can(
32input_shape=(512, 512, 3), conv_channels=64, out_channels=3)
33else:
34raise ValueError(model_type)
35