| import pickle
|
|
|
|
|
| file_path = 'class_indices.pkl'
|
|
|
| try:
|
|
|
| with open(file_path, 'rb') as f:
|
|
|
| class_indices = pickle.load(f)
|
|
|
|
|
| num_classes = len(class_indices)
|
|
|
| print(f"✅ Found {num_classes} classes in '{file_path}'.")
|
|
|
|
|
| if isinstance(class_indices, dict):
|
| print("\nHere are a few examples:")
|
| for i, (class_name, index) in enumerate(class_indices.items()):
|
| if i >= 5:
|
| break
|
| print(f" - '{class_name}': {index}")
|
|
|
| except FileNotFoundError:
|
| print(f"❌ Error: The file '{file_path}' was not found.")
|
| except Exception as e:
|
| print(f"An error occurred: {e}") |