ipaddlepaddle2.2.2代码 paddle.fluid.*已经被 paddle.*取代
时间: 2023-07-23 20:13:22 浏览: 166
是的,您说得对,非常感谢您的提醒。下面是更新后的代码:
```
import paddle
import inverse_isp_paddle as inverse_isp
import os
import glob
from PIL import Image
import numpy as np
os.environ["CUDA_VISIBLE_DEVICES"] = '0'
def read_jpg(filename):
"""Read an 8-bit JPG file from disk and normalize to [0, 1]."""
image_file = paddle.static.io.file_reader(filename)
image = paddle.vision.transforms.image_decode(image_file, 'jpeg')
return paddle.cast(image, 'float32') / 255.0
def read_img(filename):
"""Read an image in most formats."""
image_file = paddle.static.io.file_reader(filename)
image = paddle.vision.transforms.image_decode(image_file, 'auto')
return paddle.cast(image, 'float32') / 255.0
def convert_to_raw(image):
"""Unprocess sRGB to packed raw."""
assert image.shape.is_compatible_with([None, None, 3])
image, metadata = inverse_isp.unprocess(image)
return image, metadata
```
阅读全文