• 로그인
  • 장바구니에 상품이 없습니다.

home2 게시판 Python, SQL 게시판 plot_model 설치오류 문의입니다.

plot_model 설치오류 문의입니다.

  • 이 주제에는 2개 답변, 2명 참여가 있으며 이경호2 년 전에 전에 마지막으로 업데이트했습니다.
3 글 보임 - 1 에서 3 까지 (총 3 중에서)
  • 글쓴이
  • #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입니다. 해결방법 알려주시면 감사하겠습니다!
    #84944

    codingapple
    키 마스터
    https://stackoverflow.com/a/61625389
    graphviz 설치파일 다운받아서 PATH 환경변수에 graphviz의 bin폴더 경로를 추가하라는군요
    #84956

    이경호
    참가자
    감사합니다.해결되었습니다!
3 글 보임 - 1 에서 3 까지 (총 3 중에서)
  • 답변은 로그인 후 가능합니다.

About

현재 월 700명 신규수강중입니다.

  (09:00~20:00) 빠른 상담은 카톡 플러스친구 코딩애플 (링크)
  admin@codingapple.com
  이용약관
ⓒ Codingapple, 강의 예제, 영상 복제 금지
top

© Codingapple, All rights reserved. 슈퍼로켓 에듀케이션 / 서울특별시 강동구 고덕로 19길 30 / 사업자등록번호 : 212-26-14752 온라인 교육학원업 / 통신판매업신고번호 : 제 2017-서울강동-0002 호 / 개인정보관리자 : 박종흠