You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
코드를 공유해주셔서 감사합니다. 다만, 가장 중요한 오류메시지를 알려주지 않으셨습니다. ㅠㅠ https://www.tensorflow.org/lite/guide/inference#inputs 가이드를 읽어보면 input, output이 적절한 버퍼여야할 것 같은데, 위에 보여주신 두 가지 모두 적절한 형태는 아닌 것 같습니다. 어떤 코드를 넣었을 때 어떤 오류 메시지가 나오는지 공유해주시면 좋을 것 같습니다.
일단 output이 나와야하니 intArrayOf(0)이 아니라 intArrayOf(1)은 되어야할 것 같네요. 물론 만드신 모델의 Input / output이 어떤 것인지 질문하신 내용만으로는 알 수 없습니다만...
#154 해결하고자 하는 문제
야학에서 배운 첫번째 딥러닝 으로 y=2x를 추론? 하는 모델을 만들고(레모네이드 판매량 예측)
모델을 따로 저장했습니다.
model.save("first_model")
시험삼아 이를 가져와서 실행 해보니 잘 되는것을 확인했습니다 .
loaded = tf.keras.models.load_model("first_model")
혹시 안드로이드에 이를 적용해 보는 방법을 알고 계신분이 계실까요??
saved_model_dir='first_model'
converter=tf.lite.TFLiteConverter.from_saved_model(saved_model_dir)
converter.target_spec.supported_ops=[tf.lite.OpsSet.TFLITE_BUILTINS,tf.lite.OpsSet.SELECT_TF_OPS]
tflite_model=converter.convert()
open('first_model.tflite','wb').write(tflite_model)
구글 검색을 통해 tflite를 만들어 내고,
10줄 내외의 코드를 작성했으며
결과적으로 안드로이드 내에서 이부분의 에러가 발생합니다.
input 1을 넣으면 output에 1*2의 값이 2가 담겨 나오기를 기대했습니다.
여러 시도를 해보며 데이터 타입에 관한 오류메시지 / shape가 맞지 않다는 메시지를 마주했습니다.
환경
android-studio
kotlin 1.4
시도해본 방법
val input=intArrayOf(1)
val output=intArrayOf(0)
tflite.run(input, output)
The text was updated successfully, but these errors were encountered: