forked from nkhong84/YUHS-VERTE-X
-
Notifications
You must be signed in to change notification settings - Fork 0
/
run.py
57 lines (41 loc) · 1.1 KB
/
run.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
import cv2
import random
import os, sys
from glob import glob
import numpy as np
from .model import load_model
from .model.core import test_score
from .utils.data_loader import load_dataloader
from collections import defaultdict
import torch
import torch.nn as nn
import warnings
from glob import glob
import warnings
import gc
import pandas as pd
from tqdm import tqdm
warnings.filterwarnings(action='ignore')
torch.backends.cudnn.benchmark = True
# Seed
RANDOM_SEED = 1111
torch.manual_seed(RANDOM_SEED)
torch.cuda.manual_seed(RANDOM_SEED)
np.random.seed(RANDOM_SEED)
random.seed(RANDOM_SEED)
def main(args):
# Argument
args.stype = "osteoporosis"
args.exp_pth = "exp"
if args.resume != None:
resume = sorted(glob(f"{exp_folder}/{stype}/*.pth"))[-1]
args.resume = resume
# GPU setting
device = torch.device(f'cuda:{args.gpu_id}' if torch.cuda.is_available() else 'cpu')
# dataloader
dataloader = load_dataloader(args)
# Model
model = load_model(args,device)
res = test_score(dataloader, device, model, args)
if __name__ == '__main__':
main()