3 글 보임 - 1 에서 3 까지 (총 3 중에서)
-
글쓴이글
-
2023년 5월 28일 10:54 #84865
이경호참가자import tensorflow as tf import matplotlib.pyplot as plt import numpy as np
(trainX,trainY),(testX,testY) = tf.keras.datasets.fashion_mnist.load_data()
trainX = trainX.reshape((trainX.shape[0],28,28,1)) testX = testX.reshape((testX.shape[0],28,28,1)) model = tf.keras.Sequential([ tf.keras.layers.Conv2D(32,(3,3),padding='same',activation='relu',input_shape = (28,28,1)), tf.keras.layers.MaxPooling2D((2,2)), tf.keras.layers.Conv2D(32,(3,3),padding='same',activation='relu',input_shape = (28,28,1)), tf.keras.layers.MaxPooling2D((2,2)), tf.keras.layers.Flatten(), tf.keras.layers.Dense(64,activation='relu'), tf.keras.layers.Dense(10,activation='softmax'), ])
# from tensorflow.keras.utils import plot_model
tf.keras.utils.plot_model(model, to_file='model.png', show_shapes=True, show_layer_names=True)
import time
tensorboard = tf.keras.callbacks.TensorBoard(log_dir='logs/{}' .format('Conv2' + str(int(time.time())))) model.compile(loss = "sparse_categorical_crossentropy",optimizer='adam',metrics=['accuracy']) exit() C:\Users103\Desktop\deeplearning>C:/Users/82103/AppData/Local/Microsoft/WindowsApps/python3.11.exe c:/Users/82103/Desktop/deeplearning/fashion.py Traceback (most recent call last): File "c:\Users103\Desktop\deeplearning\fashion.py", line 23, in <module> tf.keras.utils.plot_model(model, to_file='model.png', show_shapes=True, show_layer_names=True) File "C:\Users103\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.11_qbz5n2kfra8p0\LocalCache\local-packages\Python311\site-packages\keras\utils\vis_utils.py", line 464, in plot_model raise ImportError(message) ImportError: You must install pydot (`pip install pydot`) and install graphviz (see instructions at https://graphviz.gitlab.io/download/) for plot_model to work. 제가 위 에러를 보고 pydot,pydotplus,graphviz를 설치하였는데도, 똑같은 오류가 뜹니다. pydot==1.4.2 pydotplus==2.0.2 graphviz==0.20.1 이 버전들을 각각 설치하였습니다. 실습환경은 vscode입니다. 해결방법 알려주시면 감사하겠습니다!
2023년 5월 28일 20:22 #84944
codingapple키 마스터https://stackoverflow.com/a/61625389 graphviz 설치파일 다운받아서 PATH 환경변수에 graphviz의 bin폴더 경로를 추가하라는군요
-
글쓴이글
3 글 보임 - 1 에서 3 까지 (총 3 중에서)
- 답변은 로그인 후 가능합니다.