python - 游戏对象检测
问题描述
我想为 Flappy Bird 创建一个 AI,我想使用对象检测和神经网络(我知道这不是最有效的方法,但这是我需要的方法)。我使用了 ImageAI python 模块,但它并没有真正做我想做的事情。我的代码是:
from imageai.Detection import ObjectDetection
import os
execution_path = os.getcwd()
detector = ObjectDetection()
detector.setModelTypeAsRetinaNet()
detector.setModelPath( os.path.join(execution_path , "resnet50_coco_best_v2.0.1.h5"))
detector.loadModel()
detections = detector.detectObjectsFromImage(input_image=os.path.join(execution_path , "image.jpg"), output_image_path=os.path.join(execution_path , "imagenew.jpg"))
for eachObject in detections:
print(eachObject["name"] , " : " , eachObject["percentage_probability"] )
我给了它这张图片,看看它是否知道这是一个对象:
但它没有做任何事情。
所以我的问题是:有什么东西可以在没有数据库的情况下检测对象吗?
解决方案
推荐阅读
- java - Selenium chrome web-driver 在选择下拉元素时不一致
- html - 如何从我的 URL 中删除文件路径和 .html 扩展名?
- vue.js - 使用 Edge 浏览器 Vuetify 空白显示
- authentication - 使用 gRPC 实现用户身份验证
- sql - 查询仅更新日期,不带时间戳
- azure - Azure 应用程序网关专用 ip dns 解析
- macos - 如何在 Mac OSX 上永久授予自己在第二个内部硬盘驱动器上写入 NPM 安装的权限
- javascript - Chart.js 在空线和空点填充颜色工具提示
- javascript - Vuetify form .$refs validate 不是函数
- python - 将 Lambda Authorizer 输出添加到其他 Lambda 的输入