Comments (2)
- Forgot to fix the version
from game-bot.
I simplified the code, it opens the next files.
`# Arda Mavi
QuickMash's Fix for create_dataset.py
import os
import numpy as np
import scipy.misc
from PIL import ImageGrab
from game_control import *
import predict
from game_control import get_id
from get_dataset import save_img
from multiprocessing import Process
from keras.models import model_from_json
from pynput.mouse import Listener as mouse_listener
from pynput.keyboard import Listener as key_listener
def get_screenshot():
img = ImageGrab.grab()
img = np.array(img)[:,:,:3] # Get first 3 channel from image as numpy array.
img = imresize(img, (150, 150, 3)).astype('float32')/255.
return img
def save_event_keyboard(data_path, event, key):
key = get_id(key)
data_path = data_path + '/-1,-1,{0},{1}'.format(event, key)
screenshot = get_screenshot()
save_img(data_path, screenshot)
return
def save_event_mouse(data_path, x, y):
data_path = data_path + '/{0},{1},0,0'.format(x, y)
screenshot = get_screenshot()
save_img(data_path, screenshot)
return
def listen_mouse():
data_path = 'Data/Train_Data/Mouse'
if not os.path.exists(data_path):
os.makedirs(data_path)
def on_click(x, y, button, pressed):
save_event_mouse(data_path, x, y)
def on_scroll(x, y, dx, dy):
pass
def on_move(x, y):
pass
with mouse_listener(on_move=on_move, on_click=on_click, on_scroll=on_scroll) as listener:
listener.join()
def listen_keyboard():
data_path = 'Data/Train_Data/Keyboard'
if not os.path.exists(data_path):
os.makedirs(data_path)
def on_press(key):
save_event_keyboard(data_path, 1, key)
def on_release(key):
save_event_keyboard(data_path, 2, key)
with key_listener(on_press=on_press, on_release=on_release) as listener:
listener.join()
def main():
dataset_path = 'Data/Train_Data/'
if not os.path.exists(dataset_path):
os.makedirs(dataset_path)
# Start to listening mouse with new process:
Process(target=listen_mouse, args=()).start()
listen_keyboard()
return
if name == 'main':
main()
QuickMash wuz here`
from game-bot.
Related Issues (20)
- versions
- some keys wont work HOT 2
- mac support HOT 1
- Error in create_dataset.py HOT 1
- The key presses being passed to game_control.py aren't formatted right
- ImportError: cannot import name 'imresize' from 'scipy.misc' HOT 4
- SyntaxError: invalid syntax
- This project is still being worked on ? HOT 8
- Module not found error
- how do i fix this.
- Traceback (most recent call last): File "C:\Users\OneDrive\Desktop\Game-Bot-master\Game-Bot-master\train.py", line 4, in <module> from get_dataset import get_dataset File "C:\Users\OneDrive\Desktop\Game-Bot-master\Game-Bot-master\get_dataset.py", line 4, in <module> from keras.utils import to_categorical ImportError: cannot import name 'to_categorical' from 'keras.utils' (C:\Users\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.9_qbz5n2kfra8p0\LocalCache\local-packages\Python39\site-packages\keras\utils\__init__.py) ------------------ (program exited with code: 1) Press any key to continue . . . HOT 1
- how do i get everything to work HOT 2
- Lots of errors
- issue with imwrite HOT 1
- Gg
- FileNotFoundError: [Errno 2] No such file or directory: 'Data/Model/model.json' HOT 1
- Tensorflow and keras doesn't give me to create_dataset and also code doesn't actually worked then i made everything like readme file so i have no idea what to do
- I can't train or run Ai.py and train.py and i don't know why HOT 1
- issue
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from game-bot.