-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.py
69 lines (52 loc) · 2.44 KB
/
main.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
# My import
import constants as const
from utils.pre_processing import checking_dataset
from utils.general_functions import define_workspace_folders
from utils.general_functions import download_dataset_from_kaggle
from utils.general_functions import download_models_saves_from_drive
from classifiers import classification_and_evaluation
# Imported to get package version info.
import sklearn
import platform
import tensorflow
import warnings
warnings.filterwarnings(action="ignore")
# ************************ #
# ********* MAIN ********* #
# ************************ #
# Main class of the project
def main():
"""
Main function.
Provides information about the versions of Python and relevant packages
(Scikit-learn, Tensorflow), checks the dataset if required, and performs classification
and evaluation of models.
:return: None
"""
# Python Packages Version info.
print("\n> Version control")
print("- Python version is: {}".format(platform.python_version()))
print("- Scikit-learn version is: {}".format(sklearn.__version__))
print("- Tensorflow version is: {}".format(tensorflow.__version__))
print("________________________________________________________________________________")
# Set up the project folders workspace
define_workspace_folders()
# Download the dataset from Kaggle website
download_dataset_from_kaggle(dataset_id=const.DATASET_ID, dataset_path=const.DATASET_PATH)
# Checking the dataset
check_dataset = input("\n> Preprocessing: is it necessary to check the dataset? [Y/N]: ")
if check_dataset.upper() == "Y":
checking_dataset(dataset_path=const.DATASET_PATH,
train_dir_path=const.TRAIN_DIR,
test_dir_path=const.TEST_DIR,
show_plot=False, save_plot=True)
print("________________________________________________________________________________")
# Download models' saves from Google drive folder
download_models_saves_from_drive(models_dir=const.MODELS_PATH,
drive_url=const.GDRIVE_URL, root_dir=const.PROJECT_ROOT)
print("________________________________________________________________________________")
# Classification and Evaluation of the Models
classification_and_evaluation(train_path=const.TRAIN_DIR, test_path=const.TEST_DIR,
show_plot=False, save_plot=True)
if __name__ == '__main__':
main()