cleaned up for submission
This commit is contained in:
14
Tune.py
14
Tune.py
@@ -5,7 +5,6 @@ from sklearn.metrics import classification_report
|
||||
import copy
|
||||
|
||||
# Framework and Utility Imports
|
||||
import SetUp
|
||||
import Util
|
||||
from sets.Data import *
|
||||
from sets.IdentitySubset import IdentitySubset
|
||||
@@ -43,6 +42,16 @@ RESOLUTION:int = 224
|
||||
'''
|
||||
ARCH = Architecture.RESNET34
|
||||
|
||||
def get_device():
|
||||
|
||||
if torch.cuda.is_available():
|
||||
# clear cach to boost memory
|
||||
# for new round
|
||||
torch.cuda.empty_cache()
|
||||
return torch.device("cuda")
|
||||
else:
|
||||
return torch.device("cpu")
|
||||
|
||||
|
||||
# Data preparation and model setup
|
||||
def prepare_data_and_model_environment():
|
||||
@@ -50,7 +59,8 @@ def prepare_data_and_model_environment():
|
||||
Handles environment discovery, downloads/loads datasets, generates
|
||||
train-test class splits, and configures the architecture base.
|
||||
"""
|
||||
device = SetUp.get_device()
|
||||
# get Cuda or CPU.
|
||||
device = get_device()
|
||||
dataset_name = Set_Name.CASIAFACES
|
||||
if dataset_name == Set_Name.CASIAFACES:
|
||||
SAMPLE_SIZE = 400
|
||||
|
||||
Reference in New Issue
Block a user