forked from waldo-vision/aimbot-detection-prototype
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtest_rnn.py
37 lines (24 loc) · 893 Bytes
/
test_rnn.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
import sys
import torch
import os
assert len(sys.argv) >= 2, "File requires input path"
inFile = sys.argv[1]
assert os.path.isfile(inFile), "not a valid file"
inDir = False
if len(sys.argv) > 2:
inDir = sys.argv[2]
assert os.path.isdir(inDir), "not a valid directory"
device = torch.device('cuda' if torch.cuda.is_available() else 'cpu')
model = torch.load("./models/model.pt")
data = torch.load(inFile)
times = []
if inDir:
times = [ (f.name).replace("_", ":") for f in os.scandir(inDir) if f.is_dir() ]
assert len(times) == data.shape[0], "number of clips doesnt match feature data"
model.eval()
with torch.no_grad():
for i in range(len(data)):
curr_test = data[i].unsqueeze(0)
output = model(curr_test)
output = output.item()
print(f'Clip at {times[i]}: {"Regular Gameplay Detected" if output < 0.5 else "Aimbot Detected"}')