mrdbourke / tensorflow-deep-learning

All course materials for the Zero to Mastery Deep Learning with TensorFlow course.
https://dbourke.link/ZTMTFcourse
MIT License
5.19k stars 2.55k forks source link

07 - Food Vision Big - Scikit-learn accuracy poor results #621

Open Qlexio opened 9 months ago

Qlexio commented 9 months ago

Discussed in https://github.com/mrdbourke/tensorflow-deep-learning/discussions/620

Originally posted by **Qlexio** December 30, 2023 I have been facing poor results while using scikit-learn accuracy whereas tensorflow's evaluation was good. Here is the initial code: ``` # unbatch test_data and extract labels y_labels = [] for image, label in test_data.unbatch(): y_labels.append(label.numpy().argmax()) y_labels[:10] ``` It returns a serie of 0s. ### Fix label variable is a unique integer. So, argmax of an integer always returns 0. To fix this, drop the `.argmax()` fonction.