Downloads · 30 days
0
PIG999/cookie-run-bot-ai
cookie-run-bot-ai is a machine learning model from PIG999. Use it for the machine learning task on the model card, and read the license before you ship it in a product. The card lists the license as mit.
基於 PyTorch 訓練的卷積神經網路 (CNN) 模型,用於即時解析《跑跑薑餅人:烤箱大逃亡》遊戲畫面並做出操作決策。
Downloads · 30 days
0
Access
Public
Updated Aug 9, 2026
Repo size
46.1 MB
Likes
0
Public
Click a slice to open those files.
.pth46.1 MB · 100%
From the Hugging Face model README
基於 PyTorch 訓練的卷積神經網路 (CNN) 模型,用於即時解析《跑跑薑餅人:烤箱大逃亡》遊戲畫面並做出操作決策。
0: None (無動作 / 正常奔跑)1: Jump (跳躍)2: Slide (滑行)3: Enter (發動技能)import torch
import cv2
import numpy as np
from model import CookieNet
device = torch.device("cuda" if torch.cuda.is_available() else "cpu")
model = CookieNet().to(device)
model.load_state_dict(torch.load("cookie_bot2.pth", map_location=device))
model.eval()
# 影像前處理 (Resize to 200x112)
img = cv2.imread("screenshot.jpg")
img_resized = cv2.resize(img, (200, 112))
img_tensor = torch.tensor(np.transpose(img_resized.astype(np.float32) / 255.0, (2, 0, 1))).unsqueeze(0).to(device)
with torch.no_grad():
output = model(img_tensor)
action = torch.argmax(output, dim=1).item()
labels = ["None", "Jump", "Slide", "Enter"]
print(f"預測動作: {labels[action]}")