Пример #1
0
    def __init__(self, output='output', weight_path=None, render_factor=32):
        # self.input = input
        self.output = os.path.join(output, 'DeOldify')
        self.render_factor = render_factor
        self.model = build_model()
        if weight_path is None:
            weight_path = get_path_from_url(DEOLDIFY_WEIGHT_URL)

        state_dict = paddle.load(weight_path)
        self.model.load_dict(state_dict)
        self.model.eval()
Пример #2
0
    def __init__(self,
                 output='output',
                 weight_path=None,
                 artistic=False,
                 render_factor=32):
        self.output = os.path.join(output, 'DeOldify')
        if not os.path.exists(self.output):
            os.makedirs(self.output)
        self.render_factor = render_factor
        self.model = build_model(
            model_type='artistic' if artistic else 'stable')
        if weight_path is None:
            if artistic:
                weight_path = get_path_from_url(DEOLDIFY_ART_WEIGHT_URL)
            else:
                weight_path = get_path_from_url(DEOLDIFY_STABLE_WEIGHT_URL)

        state_dict = paddle.load(weight_path)
        self.model.load_dict(state_dict)
        self.model.eval()