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

home2 게시판 Python, SQL 게시판 cnn 2만장 3초만에 만들기 파트에 seed 부분에서 에러가 납니다

cnn 2만장 3초만에 만들기 파트에 seed 부분에서 에러가 납니다

2 글 보임 - 1 에서 2 까지 (총 2 중에서)
  • 글쓴이
  • #5551

    정민욱
    참가자

    train_ds = tf.keras.preprocessing.image_dataset_from_directory(
    '/content/dataset/',
    image_size=(64,64),
    batch_size=64,
    subset='training',
    validation_split=0.2,
    seed=1234
    )
    이렇게 코드를 짜서 돌렸는데 seed부분에서 에러가 납니다.

    에러 코드는

    ValueError Traceback (most recent call last)

    /usr/local/lib/python3.6/dist-packages/tensorflow/python/framework/op_def_library.py in _apply_op_helper(op_type_name, name, **keywords)
    521 as_ref=input_arg.is_ref,
    --> 522 preferred_dtype=default_dtype)
    523 except TypeError as err:

    21 frames
    ValueError: Tensor conversion requested dtype string for Tensor with dtype float32: <tf.Tensor 'args_0:0' shape=() dtype=float32>

    During handling of the above exception, another exception occurred:

    TypeError Traceback (most recent call last)

    /usr/local/lib/python3.6/dist-packages/tensorflow/python/framework/op_def_library.py in _apply_op_helper(op_type_name, name, **keywords)
    543 if input_arg.type != types_pb2.DT_INVALID:
    544 raise TypeError("%s expected type of %s." %
    --> 545 (prefix, dtypes.as_dtype(input_arg.type).name))
    546 else:
    547 # Update the maps with the default, if needed.

    TypeError: Input 'filename' of 'ReadFile' Op has type float32 that does not match expected type of string.

     

    이런 에러가 나는데 해결 방안이 없을까요??

    #5552

    codingapple
    키 마스터

    실은 image_dataset_from_어쩌구가 좀 이상한 함수라 그렇습니다.

    Input ‘filename’ of ‘ReadFile’ Op has type float32 that does not match expected type of string 이런 에러가 나는 이유는

     

    1. 경로가 잘못되어서 이미지 파일이 없을 때 이런 에러가 뜹니다.

    이미지가 잘 들어있는지 확인합시다. 그리고 지금 설정한 /content/dataset/ 안의 하위폴더에 이미지가 담겼는지도요

     

    또는 2. 이미지 파일명들이 숫자로 시작할 때 이런 에러가 뜹니다. 그건 그냥 텐서플로우가 이상한건데

    그렇다면 파일명을 전부 문자로 시작하도록 바꿔줘야합니다.

     

     

2 글 보임 - 1 에서 2 까지 (총 2 중에서)
  • 답변은 로그인 후 가능합니다.

About

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

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

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