当前位置:网站首页>Pychrm Community Edition calls matplotlib pyplot. Solution of imshow() function image not popping up
Pychrm Community Edition calls matplotlib pyplot. Solution of imshow() function image not popping up
2022-07-06 18:58:00 【--Jize--】
Preface
Learn from teacher Wu Enda's deeplearningai Course , Complete programming assignment 2 of the second week , I want to be here pycharm Rewrite the code in , It is found that the image does not display after loading the dataset .
Environmental Science
win10
anaconda3
python3.8
pychrm-community-2022.1.3
resolvent
Method 1 :
Import pylab library (pylab yes matplotlib One of the modules in , Import directly .)
stay plt.imshow(train_set_x_orig[index]) Add a sentence after pylab.show()
import numpy as np
from matplotlib import pyplot as plt
import h5py
import scipy
from PIL import Image
from scipy import ndimage
import scipy.misc
import pylab
def load_dataset():
train_dataset = h5py.File('datasets/train_catvnoncat.h5', "r")
train_set_x_orig = np.array(train_dataset["train_set_x"][:]) # your train set features
train_set_y_orig = np.array(train_dataset["train_set_y"][:]) # your train set labels
test_dataset = h5py.File('datasets/test_catvnoncat.h5', "r")
test_set_x_orig = np.array(test_dataset["test_set_x"][:]) # your test set features
test_set_y_orig = np.array(test_dataset["test_set_y"][:]) # your test set labels
classes = np.array(test_dataset["list_classes"][:]) # the list of classes
train_set_y_orig = train_set_y_orig.reshape((1, train_set_y_orig.shape[0]))
test_set_y_orig = test_set_y_orig.reshape((1, test_set_y_orig.shape[0]))
return train_set_x_orig, train_set_y_orig, test_set_x_orig, test_set_y_orig, classes
train_set_x_orig, train_set_y, test_set_x_orig, test_set_y, classes = load_dataset()
index = 5
plt.imshow(train_set_x_orig[index])
pylab.show()
print("y = " + str(train_set_y[:, index]) + ", it's a '" + classes[np.squeeze(train_set_y[:, index])].decode(
"utf-8") + "' picture.")
Method 2 :
stay plt.imshow(train_set_x_orig[index]) Add a sentence after plt.show()
PS
- The online solution is pycharm–>File | Settings | Tools | Python Scientific | Uncheck the Show plots in tool window, But mine pycharm There is no Python Scientific This option
- pycharm Use plt Don't show picture solutions
This blog explains why jupyter Can be displayed in and pycharm Cannot display . - I feel that the image source of China University of science and technology is very easy to use
pip3 install -i https://pypi.mirrors.ustc.edu.cn/simple/ pylab
边栏推荐
- R语言ggplot2可视化:使用ggpubr包的ggdotplot函数可视化点阵图(dot plot)、设置palette参数设置不同水平点阵图数据点和箱图的颜色
- 十、进程管理
- How to improve website weight
- AvL树的实现
- Penetration test information collection - App information
- 多线程基础:线程基本概念与线程的创建
- 一种用于夜间和无袖测量血压手臂可穿戴设备【翻译】
- 监控界的最强王者,没有之一!
- Online notes
- If you have any problems, you can contact me. A rookie ~
猜你喜欢
人体骨骼点检测:自顶向下(部分理论)
Self supervised heterogeneous graph neural network with CO comparative learning
十、进程管理
Unlock 2 live broadcast themes in advance! Today, I will teach you how to complete software package integration Issues 29-30
[depth first search] Ji suanke: find numbers
爬虫玩得好,牢饭吃到饱?这3条底线千万不能碰!
Estimate blood pressure according to PPG using spectral spectrum time depth neural network [turn]
Collection of penetration test information -- use with nmap and other tools
二叉搜索树
AutoCAD - what is the default lineweight for centerline drawing and CAD? Can I modify it?
随机推荐
多线程基础:线程基本概念与线程的创建
test about BinaryTree
Reproduce ThinkPHP 2 X Arbitrary Code Execution Vulnerability
Docker installation redis
涂鸦智能在香港双重主板上市:市值112亿港元 年营收3亿美元
Handwritten online chat system (principle part 1)
Qlabel marquee text display
Based on butterfly species recognition
一种用于夜间和无袖测量血压手臂可穿戴设备【翻译】
DOM Brief
QPushButton绑定快捷键的注意事项
Execution process of MySQL query request - underlying principle
如何提高网站权重
Method of accessing mobile phone storage location permission under non root condition
Jdbc driver, c3p0, druid and jdbctemplate dependent jar packages
Wx applet learning notes day01
Three years of Android development, Android interview experience and real questions sorting of eight major manufacturers during the 2022 epidemic
Reptiles have a good time. Are you full? These three bottom lines must not be touched!
十、进程管理
Lucun smart sprint technology innovation board: annual revenue of 400million, proposed to raise 700million