From 700c0a0b6f0a785da7b54abdb0a6bfca3e16c072 Mon Sep 17 00:00:00 2001 From: changjiaxiang Date: Wed, 19 Jun 2024 19:45:35 +0800 Subject: [PATCH] =?UTF-8?q?=E8=A7=86=E9=A2=91=E5=88=86=E5=89=B2=E6=97=B6?= =?UTF-8?q?=E5=85=BC=E5=AE=B9=E4=B8=8D=E5=90=8C=E8=A7=86=E9=A2=91=E6=A0=BC?= =?UTF-8?q?=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- videoCut.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/videoCut.py b/videoCut.py index 7805076..b83fd09 100644 --- a/videoCut.py +++ b/videoCut.py @@ -22,6 +22,10 @@ def SSIM(imgPath0, imgPath1): def imageEncoder(model,preprocess,device,img): + if img.dtype == 'uint16': + img = (img / 256).astype('uint8') + if img.shape[2] == 4: + img = img[:, :, :3] img1 = Image.fromarray(img).convert('RGB') img1 = preprocess(img1).unsqueeze(0).to(device) img1 = model.encode_image(img1)