I’m encountering a strange issue with training my custom AI classification model. My desktop, which has 32GB of RAM and a 4GB GPU, is significantly slower than my laptop that only has 8GB of RAM and no GPU. While the laptop completes the training in around 10 minutes, the desktop takes nearly an hour. Both computers are running different versions of Windows. Below is my training code for reference:
labels = []
data_arrays = []
flattened_arrays = []
DATA_PATH = r"Images"
CLASS_NAMES = ['cat1', 'cat2', 'cat3', 'cat4']
for category in CLASS_NAMES:
category_id = CLASS_NAMES.index(category)
folder_path = os.path.join(DATA_PATH, category)
for file_name in os.listdir(folder_path):
picture = Image.open(os.path.join(folder_path, file_name))
if 'compression' in picture.info:
comp_type = picture.info['compression']
if comp_type == 'group4':
picture.save(os.path.join(folder_path, file_name), compression='tiff_lzw')
image_data = imread(os.path.join(folder_path, file_name))
resized_img = resize(image_data, (200, 200))
flattened_arrays.append(resized_img.flatten())
data_arrays.append(resized_img)
labels.append(category_id)
X_data = np.array(flattened_arrays)
y_data = np.array(labels)
image_data = np.array(data_arrays)
from sklearn.model_selection import train_test_split
X_train, X_test, y_train, y_test = train_test_split(X_data, y_data, test_size=0.3, random_state=42)
from sklearn.model_selection import GridSearchCV
from sklearn import svm
parameters = [
{'C': [1, 10, 100, 1000], 'kernel': ['linear']},
{'C': [1, 10, 100, 1000], 'gamma': [0.001, 0.0001], 'kernel': ['rbf']}
]
model = svm.SVC(probability=True)
classifier = GridSearchCV(model, parameters)
classifier.fit(X_train, y_train)
What might be causing this significant difference in training times?