简体   繁体   English

Pytorch MNIST ResNet50 ValueError: Target is multiclass but average='binary'

[英]Pytorch MNIST ResNet50 ValueError: Target is multiclass but average='binary'

https://colab.research.google.com/github/kjamithash/Pytorch_DeepLearning_Experiments/blob/master/FashionMNIST_ResNet_TransferLearning.ipynb#scrollTo=QrIm8SnsUmaK https://colab.research.google.com/github/kjamithash/Pytorch_DeepLearning_Experiments/blob/master/FashionMNIST_ResNet_TransferLearning.ipynb#scrollTo=QrIm8SnsUmaK

When I ran this code, I encountered a problem that:当我运行这段代码时,我遇到了一个问题:

ValueError: Target is multiclass but average='binary'. Please choose another average setting, one of [None, 'micro', 'macro', 'weighted'] ValueError: Target is multiclass but average='binary'. Please choose another average setting, one of [None, 'micro', 'macro', 'weighted'] . ValueError: Target is multiclass but average='binary'. Please choose another average setting, one of [None, 'micro', 'macro', 'weighted']

anyone knows?有谁知道?

This notebook uses inspect unit to assign proper scorer arguments, and it seems the api has changed since the notebook was published.此笔记本使用inspect单元分配正确的记分器 arguments,似乎 api 自从笔记本发布以来发生了变化。 Specifically at this point:具体到这一步:

def calculate_metric(metric_fn, true_y, pred_y):
    if "average" in inspect.getfullargspec(metric_fn).args:
    ...

'average' is not in the args list anymore. 'average'不再在args列表中。 Using inspect.getfullargspec(metric_fn).kwonlyargs instead should fix the issue.使用inspect.getfullargspec(metric_fn).kwonlyargs应该可以解决问题。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 为 ResNet50 重塑 MNIST - Reshaping MNIST for ResNet50 面对ValueError:目标是多类但平均值='二进制' - Facing ValueError: Target is multiclass but average='binary' 如何在 PyTorch 中实现 ResNet50? - how to implement ResNet50 in PyTorch? 在 PyTorch 中加载 resnet50 prettriated model - Loading resnet50 prettrianed model in PyTorch ValueError:Target是多类但是average ='binary'。 请选择其他平均设置 - ValueError: Target is multiclass but average='binary'. Please choose another average setting 从 pytorch 中的预训练 resnet50 中提取特征 - Extract features from pretrained resnet50 in pytorch Pytorch fastrcnn resnet50 fpn 损失函数 - Pytorch fasterrcnn resnet50 fpn loss functions Output 使用 keras ResNet50 model 进行二进制分类的层 - Output layer for binary classification using keras ResNet50 model 值错误:目标是多类但平均值 = 二进制。 请选择另一个平均设置,[无、'微'、'宏'、'加权'] - ValueError: Target is multiclass but average='binary'. Please choose another average setting, one of [None, 'micro', 'macro', 'weighted'] sklearn - ValueError: 目标是多类但平均值 = 二进制。 请选择另一个平均设置,[无、'微'、'宏'、'加权'] - sklearn - ValueError: Target is multiclass but average='binary'. Please choose another average setting, one of [None, 'micro', 'macro', 'weighted']
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM