What is the difference between the predict and predict_on_batch methods of a Keras model?
What is the difference between the predict and predict_on_batch methods of a Keras model?
According to the keras documentation: predict_on_batch(self, x) Returns predictions for a single batch of samples. However, there does not seem to be any difference with the standard predict method
stackoverflow.com
predict와 predict_on_batch는 기능적 차이는 크게 없고
predict에 추가적 동작(배치 컬렉션이 제대로 동작하는지 확인하는??)이 부과되어 있는 듯 했음
predict는 모든 데이터를 배치by배치로 예측 수행 (네트워크에 매번 배치단위로 데이터를 넣음)
predict_on_batch는 정확히 하나의 배치로 데이터를 가정하고 네트워크로 넣음
predict_on_batch가 predict보다 속도면에서도 빠른 모습.
그래서 내가 테스트 해보고 싶은 데이터단을 정확히 하나의 배치로 두고
predict할 것이라면 predict_on_batch를 사용하는 편이 좋을 듯?
'AI > tensorflow' 카테고리의 다른 글
학습 중지된 경우 이어서 하려면? (0) | 2023.09.19 |
---|---|
[Tensorflow] EfficientNet 예제 (0) | 2023.02.14 |
AttributeError: 'Functional' object has no attribute 'predict_proba' (0) | 2023.01.27 |
[tf.data] data transform하여 dataset 추가하기 (0) | 2022.12.22 |
자주 사용하는 Tensor함수 정리 (0) | 2022.12.22 |