zoukankan      html  css  js  c++  java
  • An AI to play the Rock Paper Scissors game

    An AI to play the Rock Paper Scissors game

    https://github.com/SouravJohar/rock-paper-scissors

    此项目给出了一个使用OpenCV + CNN 做手势识别,和机器人随机对战的界面游戏。

    https://youtu.be/0uSA3xyXlwM

    An AI to play the Rock Paper Scissors game


    https://learnopencv.com/playing-rock-paper-scissors-with-ai/

    给出了实现过程的详解。

    Here’s a breakdown of our application in steps.

    1. Step 1: Gather Data, for rock, paper scissor classes.
    2. Step 2: (Optional) Visualize the Data.
    3. Step 3: Preprocess Data and Split it.
    4. Step 4: Prepare Our Model for Transfer Learning.
    5. Step 5: Train Our Model.
    6. Step 6: Check our Accuracy, Loss graphs & save the model.
    7. Step 7: Test on Live Webcam Feed.
    8. Step 8: Create the Final Application.

    问题-1

    手势数据为自行收集,数据收集的质量和数量, 对手势的识别准确度影响较大。

    解决方法

    https://colab.research.google.com/github/trekhleb/machine-learning-experiments/blob/master/experiments/rock_paper_scissors_cnn/rock_paper_scissors_cnn.ipynb#scrollTo=Q8lENOmkmiBF

    TensorFlow提供了此游戏的手势数据集,可以直接使用

    DATASET_NAME = 'rock_paper_scissors'

    (dataset_train_raw, dataset_test_raw), dataset_info = tfds.load(
        name=DATASET_NAME,
        data_dir='tmp',
        with_info=True,
        as_supervised=True,
        split=[tfds.Split.TRAIN, tfds.Split.TEST],
    )

    问题-2

    此处的智能为视觉识别上的智能, 对于对弈过程中,机器人仅仅使用随机方法,来出招。

    对于此机器人,可以对出招的策略进行建模,学习。

    Q-learning强化学习版本

    https://github.com/fanqingsong/rock-paper-scissors-AI-Bot/blob/master/play.py

    还可以使用RNN来预测对手的出招

    https://github.com/fanqingsong/boilerplate-rock-paper-scissors/blob/master/RPS.py

    以及其他方法:

    http://www.datasmith.org/2020/05/17/ai-for-rock-paper-scissors/

    感知机等

    There are other possible approaches, too:

    • Monte Carlo approaches have been suggested, but it’s unlikely that a sufficiently large population of throws *made under extremely similar circumstances* could be obtained as the basis for MC simulation. I also suspect that the combinatorial space of the problem isn’t large enough to make MC a good approach.
    • A Markov chain (a contextual Markov chain, not a pure Markov process) seems like a tempting approach, but as with Monte Carlo, part of the challenge would be in building up a corpus of observed throws from which to project the next throw. This approach may be very powerful but would require both an interesting Markov chain algorithm, and a pre-existing body of game histories from which scenarios relevant to the current game could be selected. Further research on this would be interesting.
    • Bayesian logic seems like a good fit, since we are taking a sequence of observations (throws) and adjusting an expected outcome. An important challenge, however, would be this: how would the Bayesian model react to sudden changes of opponent strategy? If an opponent who has thrown scissors twenty times suddenly throws paper four times, can the Bayesian model be re-weighted to represent the fact that the next throw is likely to be paper? I’m not sure.
    出处:http://www.cnblogs.com/lightsong/ 本文版权归作者和博客园共有,欢迎转载,但未经作者同意必须保留此段声明,且在文章页面明显位置给出原文连接。
  • 相关阅读:
    在opencv3中实现机器学习之:利用正态贝叶斯分类
    在opencv3中进行图片人脸检测
    在opencv3中利用SVM进行图像目标检测和分类
    在opencv3中实现机器学习之:利用svm(支持向量机)分类
    在matlab和opencv中分别实现稀疏表示
    opencv2学习:计算协方差矩阵
    用python简单处理图片(3):添加水印
    Google protocol buffer在windows下的编译
    GEOS库学习之五:与GDAL/OGR结合使用
    GEOS库学习之四:几何关系判断
  • 原文地址:https://www.cnblogs.com/lightsong/p/14781525.html
Copyright © 2011-2022 走看看