Spaces:
Runtime error
Runtime error
Update
Browse files- train_model.py +5 -3
train_model.py
CHANGED
|
@@ -9,7 +9,9 @@ from tensorflow.keras.optimizers import Adam
|
|
| 9 |
from tqdm import tqdm
|
| 10 |
|
| 11 |
# Load dataset dari Hugging Face
|
| 12 |
-
|
|
|
|
|
|
|
| 13 |
NUM_CLASSES = 196
|
| 14 |
IMG_SIZE = 224
|
| 15 |
BATCH_SIZE = 32
|
|
@@ -22,8 +24,8 @@ def preprocess(example):
|
|
| 22 |
return image, example["label"]
|
| 23 |
|
| 24 |
# Apply preprocessing
|
| 25 |
-
X_train, y_train = zip(*[preprocess(x) for x in tqdm(
|
| 26 |
-
X_test, y_test = zip(*[preprocess(x) for x in tqdm(
|
| 27 |
|
| 28 |
X_train = np.array(X_train)
|
| 29 |
X_test = np.array(X_test)
|
|
|
|
| 9 |
from tqdm import tqdm
|
| 10 |
|
| 11 |
# Load dataset dari Hugging Face
|
| 12 |
+
from datasets import load_dataset
|
| 13 |
+
|
| 14 |
+
ds = load_dataset("tanganke/stanford_cars")
|
| 15 |
NUM_CLASSES = 196
|
| 16 |
IMG_SIZE = 224
|
| 17 |
BATCH_SIZE = 32
|
|
|
|
| 24 |
return image, example["label"]
|
| 25 |
|
| 26 |
# Apply preprocessing
|
| 27 |
+
X_train, y_train = zip(*[preprocess(x) for x in tqdm(ds["train"])])
|
| 28 |
+
X_test, y_test = zip(*[preprocess(x) for x in tqdm(ds["test"])])
|
| 29 |
|
| 30 |
X_train = np.array(X_train)
|
| 31 |
X_test = np.array(X_test)
|