水玉采色 2022-04-29 14:35 采纳率: 100%
浏览 140
已结题

想要知道在python def plot_images(images, labels, class_names):语句中python起什么作用以及怎样正确使用

问题遇到的现象和发生背景

使用convolution-network-natural-scenes项目代码实现Imagnette数据集的图片分类。

Imagnette是从大型数据集ImageNet(超过1400万张图片, 20,000个类别)中抽取出来的一个小数据集,由于早期研究人员和学生的计算资源有限,但他们也想在ImageNet这样的数据集上做研究和练习,因此才有了imagnette这个袖珍版的数据集。

imagenette的训练集有9469张图片,测试集有3925张图片,格式都为JPEG,图片分辨率不统一,但宽高都不小于160个像素。

问题相关代码,请勿粘贴截图

问题相关代码:
import numpy as np
import matplotlib.pyplot as plt

python
def plot_images(images, labels, class_names):
fig, axes = plt.subplots(3, 5, figsize=(12, 6))

这里plot_images函数抬头为:

def plot_images(images, labels, class_names):
运行结果及报错内容

1:name 'python' is not defined

2:2022-04-29 14:01:38.783991: I tensorflow/core/platform/cpu_feature_guard.cc:142] This TensorFlow binary is optimized with oneAPI Deep Neural Network Library (oneDNN) to use the following CPU instructions in performance-critical operations: AVX2
To enable them in other operations, rebuild TensorFlow with the appropriate compiler flags.
OMP: Error #15: Initializing libiomp5, but found libiomp5md.dll already initialized.

我的解答思路和尝试过的方法

删除python或者定义python,都会引起第2项错误。

我想要达到的结果

知道在这里python的作用,跑通程序。

  • 写回答

1条回答 默认 最新

  • ~白+黑 Python领域新星创作者 2022-04-29 16:25
    关注

    第一按照代码规范,那个python是必须要去掉的
    第二卸载干净,试着重新安装一下tensortflow,对应好python版本

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

问题事件

  • 系统已结题 6月8日
  • 已采纳回答 5月31日
  • 创建了问题 4月29日

悬赏问题

  • ¥15 用hfss做微带贴片阵列天线的时候分析设置有问题
  • ¥50 我撰写的python爬虫爬不了 要爬的网址有反爬机制
  • ¥15 Centos / PETSc / PETGEM
  • ¥15 centos7.9 IPv6端口telnet和端口监控问题
  • ¥120 计算机网络的新校区组网设计
  • ¥20 完全没有学习过GAN,看了CSDN的一篇文章,里面有代码但是完全不知道如何操作
  • ¥15 使用ue5插件narrative时如何切换关卡也保存叙事任务记录
  • ¥20 海浪数据 南海地区海况数据,波浪数据
  • ¥20 软件测试决策法疑问求解答
  • ¥15 win11 23H2删除推荐的项目,支持注册表等