Closed haomayang1126 closed 2 years ago
I also encountered this problem. Have you solved it?
targets = [SemanticSegmentationTarget(1, plopymaskfloat)] #targets是一个类 change this into targets = [SemanticSegmentationTarget(0, plopymaskfloat)] #targets是一个类
import argparse import cv2 import matplotlib.pyplot as plt
from lib.PraNet_Res2Net import PraNet import numpy as np import torch from torchvision import models import torchvision.transforms as transforms from PIL import Image import warnings warnings.filterwarnings('ignore') warnings.simplefilter('ignore') from torchvision.models.segmentation import deeplabv3_resnet50 import torch import torch.functional as F from pytorch_grad_cam.utils.model_targets import SemanticSegmentationTarget import requests from pytorch_grad_cam.utils.image import show_cam_on_image, preprocess_image
if name == 'main':