generated from ProtossDragoon/vscode-py-template
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
29 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
# dataset.py | ||
|
||
from datasets import load_dataset | ||
|
||
def load_custom_dataset(path_dataset_dir): | ||
""" | ||
Loads a dataset from the specified directory. | ||
Parameters: | ||
path_dataset_dir (str): The path to the directory containing the dataset. | ||
Returns: | ||
Dataset: The loaded dataset. | ||
""" | ||
dataset = load_dataset('imagefolder', data_dir=path_dataset_dir) | ||
return dataset | ||
|
||
if __name__ == '__main__': | ||
import os | ||
|
||
# Ensure that PATH_DATASET_DIR environment variable is set | ||
path_dataset_dir = os.getenv('data_dir') | ||
if path_dataset_dir is None: | ||
raise ValueError("Environment variable PATH_DATASET_DIR is not set") | ||
|
||
dataset = load_custom_dataset(path_dataset_dir) | ||
print(dataset) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters