leafspark commited on
Commit
1f3202f
1 Parent(s): 681cc97

Upload 18 files

Browse files
.gitattributes CHANGED
@@ -53,3 +53,5 @@ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
53
  *.jpg filter=lfs diff=lfs merge=lfs -text
54
  *.jpeg filter=lfs diff=lfs merge=lfs -text
55
  *.webp filter=lfs diff=lfs merge=lfs -text
 
 
 
53
  *.jpg filter=lfs diff=lfs merge=lfs -text
54
  *.jpeg filter=lfs diff=lfs merge=lfs -text
55
  *.webp filter=lfs diff=lfs merge=lfs -text
56
+ trainingData_1713658647.txt filter=lfs diff=lfs merge=lfs -text
57
+ trainingData_1713658890.txt filter=lfs diff=lfs merge=lfs -text
captured_image.png ADDED

Git LFS Details

  • SHA256: 8b39dffee913980b355b2c55f17be0a3af34f578cf8c9f9778c8d3ef03504443
  • Pointer size: 130 Bytes
  • Size of remote file: 14.5 kB
main.py ADDED
@@ -0,0 +1,65 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import time
2
+ import numpy as np
3
+ from PIL import ImageGrab
4
+ import keyboard
5
+
6
+
7
+ def capture_screen():
8
+ start_time = 0
9
+ filename = ''
10
+
11
+ while True:
12
+ if keyboard.is_pressed('F7') and start_time == 0: # Check if F7 is pressed to start capturing
13
+ start_time = int(time.time()) # Record start time
14
+ filename = 'trainingData_{}.txt'.format(start_time)
15
+ break
16
+
17
+ while True:
18
+ try:
19
+ if keyboard.is_pressed('F8'): # Check if F7 is pressed to stop capturing
20
+ break
21
+
22
+ # Capture entire screen
23
+ screenshot = ImageGrab.grab()
24
+
25
+ # Resize to 128x128
26
+ screenshot = screenshot.resize((128, 64))
27
+
28
+ # Convert to grayscale
29
+ grayscale_img = screenshot.convert('L')
30
+
31
+ # Convert image to numpy array
32
+ grayscale_array = np.array(grayscale_img)
33
+
34
+ # Normalize pixel values between 0 and 1 and round to 2 decimal places
35
+ grayscale_array = np.round(grayscale_array / 255.0, 1)
36
+
37
+ # Flatten array to 1D
38
+ flattened_array = grayscale_array.flatten()
39
+
40
+ # Save the image with two decimal place precision
41
+ screenshot.save('captured_image.png')
42
+
43
+ # Capture WASD keys
44
+ keys = [
45
+ int(keyboard.is_pressed(key)) for key in ['w', 'a', 's', 'd']
46
+ ]
47
+
48
+ # Append to training data file with Unix time
49
+ with open(filename, 'a') as f:
50
+ f.write("{data}\n")
51
+ f.write(str(flattened_array.tolist()) + '\n')
52
+ f.write("{action}\n")
53
+ f.write(str(keys) + '\n')
54
+
55
+ # Wait for 0.1 seconds
56
+ time.sleep(0.1)
57
+
58
+ except KeyboardInterrupt:
59
+ print("Stopping screen capture.")
60
+ break
61
+
62
+
63
+ if __name__ == "__main__":
64
+ while True:
65
+ capture_screen()
output.png ADDED

Git LFS Details

  • SHA256: 1575b3d1c610a161fdd4b325515fae8e347fe65f2a4746b1c90d423ea0f2b3b4
  • Pointer size: 129 Bytes
  • Size of remote file: 1.65 kB
trainingData_1713658458.txt ADDED
The diff for this file is too large to render. See raw diff
 
trainingData_1713658647.txt ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:aa81df1205904b51b7e0affbf1302ffd770070ee40c5d68e69b2e55c0f559f9a
3
+ size 12298200
trainingData_1713658834.txt ADDED
The diff for this file is too large to render. See raw diff
 
trainingData_1713658890.txt ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:93e79757316b89957b325685992bbfd4c7ff1f30c6815622f526736b3b0bfa02
3
+ size 11560308
trainingData_1713658970.txt ADDED
The diff for this file is too large to render. See raw diff
 
trainingData_1713659021.txt ADDED
The diff for this file is too large to render. See raw diff
 
trainingData_1713659082.txt ADDED
The diff for this file is too large to render. See raw diff
 
trainingData_1713659108.txt ADDED
The diff for this file is too large to render. See raw diff
 
trainingData_1713659138.txt ADDED
The diff for this file is too large to render. See raw diff
 
trainingData_1713659167.txt ADDED
The diff for this file is too large to render. See raw diff
 
trainingData_1713659190.txt ADDED
The diff for this file is too large to render. See raw diff
 
trainingData_1713659245.txt ADDED
The diff for this file is too large to render. See raw diff
 
trainingData_1713659328.txt ADDED
The diff for this file is too large to render. See raw diff
 
trainingData_1713659397.txt ADDED
The diff for this file is too large to render. See raw diff
 
trainingData_1713659443.txt ADDED
The diff for this file is too large to render. See raw diff