当前位置:网站首页>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
边栏推荐
- Penetration test information collection - App information
- R语言使用rchisq函数生成符合卡方分布的随机数、使用plot函数可视化符合卡方分布的随机数(Chi Square Distribution)
- [Matlab] Simulink 同一模块的输入输出的变量不能同名
- Medical image segmentation
- [paper notes] transunet: transformers make strongencoders for medical image segmentation
- openmv4 学习笔记1----一键下载、图像处理背景知识、LAB亮度-对比度
- AvL树的实现
- R language ggplot2 visualization: use the ggstripchart function of ggpubr package to visualize the grouped dot strip plot, and set the add parameter to add box plots for different levels of dot strip
- Digital "new" operation and maintenance of energy industry
- CSRF vulnerability analysis
猜你喜欢

C#/VB. Net to add text / image watermarks to PDF documents

AUTOCAD——中心线绘制、CAD默认线宽是多少?可以修改吗?

About static type, dynamic type, ID, instancetype

抽象类与抽象方法

Video based full link Intelligent Cloud? This article explains in detail what Alibaba cloud video cloud "intelligent media production" is

Understanding disentangling in β- VAE paper reading notes

应用使用Druid连接池经常性断链问题分析

How to improve website weight

Breadth first traversal of graph

十、进程管理
随机推荐
Jushan database was among the first batch of financial information innovation solutions!
Use cpolar to build a business website (1)
Human bone point detection: top-down (part of the theory)
Breadth first traversal of graph
朗坤智慧冲刺科创板:年营收4亿 拟募资7亿
[depth first search] Ji suanke: Square
深度循环网络长期血压预测【翻译】
AUTOCAD——中心线绘制、CAD默认线宽是多少?可以修改吗?
Describe the process of key exchange
How does crmeb mall system help marketing?
When visual studio code starts, it prompts "the code installation seems to be corrupt. Please reinstall." Solution to displaying "unsupported" information in the title bar
人体骨骼点检测:自顶向下(部分理论)
DOM Brief
Implementation of AVL tree
Stm32+mfrc522 completes IC card number reading, password modification, data reading and writing
ROS custom message publishing subscription example
裕太微冲刺科创板:拟募资13亿 华为与小米基金是股东
Certains marchés de l'emploi de Shanghai refusent d'embaucher des personnes qui se rétablissent positives à Xinguan
A wearable arm device for night and sleeveless blood pressure measurement [translation]
Jdbc driver, c3p0, druid and jdbctemplate dependent jar packages