You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
我在训练好的r2cnet.pth进行测试的时候,使用test文件下的一张图片进行测试,提示文本使用CLIP去生成然后转为输出尺寸,发现输出的预测图与输入的文本提示无关,以下是我的代码,请问我的操作是否有误?
`import argparse
import os
import imageio
import numpy as np
from tqdm import tqdm
from torchvision import transforms
from PIL import Image
from torch import nn
import torch
import torch.nn.functional as F
from models.utils import BasicConv2d
from models.r2cnet import Network
from data import get_dataloader
import utils.metrics as Measure
from utils.utils import load_model_params
import clip
if name == 'main':
image_size = 352
device = "cuda" if torch.cuda.is_available() else "cpu"
net = Network().to(device)
net.load_state_dict(torch.load('./r2cnet.pth')['state_dict'])
net.eval()
img_transform = transforms.Compose([
transforms.Resize((image_size, image_size)),
transforms.ToTensor(),
transforms.Normalize([0.485, 0.456, 0.406], [0.229, 0.224, 0.225])])
pic = img_transform(Image.open('./COD10K-CAM-3-Flying-51-Bee-2981.jpg')).unsqueeze(0).to(device)
print(pic.shape)
model, preprocess = clip.load("ViT-B/32", device=device)
我在训练好的r2cnet.pth进行测试的时候,使用test文件下的一张图片进行测试,提示文本使用CLIP去生成然后转为输出尺寸,发现输出的预测图与输入的文本提示无关,以下是我的代码,请问我的操作是否有误?
`import argparse
import os
import imageio
import numpy as np
from tqdm import tqdm
from torchvision import transforms
from PIL import Image
from torch import nn
import torch
import torch.nn.functional as F
from models.utils import BasicConv2d
from models.r2cnet import Network
from data import get_dataloader
import utils.metrics as Measure
from utils.utils import load_model_params
import clip
if name == 'main':
image_size = 352
device = "cuda" if torch.cuda.is_available() else "cpu"
net = Network().to(device)
net.load_state_dict(torch.load('./r2cnet.pth')['state_dict'])
net.eval()
img_transform = transforms.Compose([
transforms.Resize((image_size, image_size)),
transforms.ToTensor(),
transforms.Normalize([0.485, 0.456, 0.406], [0.229, 0.224, 0.225])])
pic = img_transform(Image.open('./COD10K-CAM-3-Flying-51-Bee-2981.jpg')).unsqueeze(0).to(device)
print(pic.shape)
model, preprocess = clip.load("ViT-B/32", device=device)
`
The text was updated successfully, but these errors were encountered: