Answers.Body: <p>The question is conceptually wrong, because of misunderstanding of area. Explanation: The idea is to replace open ai gym by something different. For example: web-site or computer game. There is no way to create an environment based on image. If you want to use implemented algorithm for open ai gym and want to change environment for your own, could do something like this: <a href="https://towardsdatascience.com/creating-a-custom-openai-gym-environment-for-stock-trading-be532be3910e" rel="nofollow noreferrer">https://towardsdatascience.com/creating-a-custom-openai-gym-environment-for-stock-trading-be532be3910e</a>. If need to change env complitely than it is necessary to rewrite your algorithm for your tasks.</p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2020-11-23T15:24:25.013Z
Answers.LastActivityDate: 2020-11-23T15:24:25.013Z
Answers.UserDisplayName: Ren
Body: <p>I am trying to create my own gym environment for the A3C algorithm (one implementation is <a href="https://github.com/dgriff777/rl_a3c_pytorch" rel="nofollow noreferrer">here</a>). The custom environment is a simple login form for any site. I want to create an environment from an image. The idea is to take a screenshot of the web page and create an environment from this screenshot for the A3C algorithm. I know the doc and protocol for creating a custom environment. But I don't understand how to create an environment, exactly, based on a screenshot.</p>
  <p>If I do so</p>
  <pre><code>self.observation_space = gym.spaces.Box(low=0, high=255, shape=(128, 128, 3), dtype=np.uint8)
  </code></pre>
  <p>I get a new pic.</p>
  <p>Here's the algorithm that I am trying to implement (page 39 of the master's thesis <a href="https://aaltodoc.aalto.fi/bitstream/handle/123456789/37895/master_Eskonen_Juha_2019.pdf?sequence=1&amp;isAllowed=y" rel="nofollow noreferrer">Deep Reinforcement Learning in Automated User Interface Testing</a> by Juha Eskonen).</p>
  <p><a href="https://i.sstatic.net/tfrJu.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/tfrJu.png" alt="enter image description here" /></a></p>
  
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2020-11-04T11:31:19.397Z
Comments.Text: Well, you need to represent the screenshot as an "observation" of your environment. A screenshot is an image, so you can read this image and turn it into an array, which should be your observation. Maybe this code https://github.com/openai/gym/blob/master/gym/wrappers/atari_preprocessing.py can be useful. In any case, I would like to note that our site focuses on theoretical questions, but this is a programming question. Given that this question is about a RL topic, I will not close it as off-topic, given that RL is central to AI. Check this: https://ai.stackexchange.com/help/on-topic.
Comments.UserDisplayName: nbro
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2020-11-04T11:48:30.170Z
Comments.Text: If you don't want to create the environment, what is your question then?
Comments.UserDisplayName: nbro
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2020-11-04T11:50:51.503Z
Comments.Text: No, I want) I just uderstand, I reread the paper many times and algorithm and understand that we use a3c for creating a probability map for each element and then we do some action using third part api, like selenium.
Comments.UserDisplayName: Ren
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2020-11-04T11:52:00.707Z
Comments.Text: Ok. But what is your question? It was "how to create this custom environment from screenshots?", right?
Comments.UserDisplayName: nbro
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2020-11-04T11:53:33.290Z
Comments.Text: Right)  My question was  "how to create this custom environment from screenshots?"
Comments.UserDisplayName: Ren
Tags: <reinforcement-learning><open-ai><gym><a3c>
Title: How do I create a custom gym environment based on an image?
UserDisplayName: Ren
ThreadText: # How do I create a custom gym environment based on an image?
  
  (Asked by: username_0 on 2020-11-03)
  
  I am trying to create my own gym environment for the A3C algorithm (one implementation is here). The custom environment is a simple login form for any site. I want to create an environment from an image. The idea is to take a screenshot of the web page and create an environment from this screenshot for the A3C algorithm. I know the doc and protocol for creating a custom environment. But I don't understand how to create an environment, exactly, based on a screenshot.
  If I do so
  self.observation_space = gym.spaces.Box(low=0, high=255, shape=(128, 128, 3), dtype=np.uint8)
  
  I get a new pic.
  Here's the algorithm that I am trying to implement (page 39 of the master's thesis Deep Reinforcement Learning in Automated User Interface Testing by Juha Eskonen).
  
  **Tags:** reinforcement-learning, open-ai, gym, a3c
  > **Comments:**
  > **username_1**: Well, you need to represent the screenshot as an "observation" of your environment. A screenshot is an image, so you can read this image and turn it into an array, which should be your observation. Maybe this code https://github.com/openai/gym/blob/master/gym/wrappers/atari_preprocessing.py can be useful. In any case, I would like to note that our site focuses on theoretical questions, but this is a programming question. Given that this question is about a RL topic, I will not close it as off-topic, given that RL is central to AI. Check this: https://ai.stackexchange.com/help/on-topic.  
  > **username_1**: If you don't want to create the environment, what is your question then?  
  > **username_0**: No, I want) I just uderstand, I reread the paper many times and algorithm and understand that we use a3c for creating a probability map for each element and then we do some action using third part api, like selenium.  
  > **username_1**: Ok. But what is your question? It was "how to create this custom environment from screenshots?", right?  
  > **username_0**: Right)  My question was  "how to create this custom environment from screenshots?"  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_0 on 2020-11-23. Score: 1
  
  The question is conceptually wrong, because of misunderstanding of area. Explanation: The idea is to replace open ai gym by something different. For example: web-site or computer game. There is no way to create an environment based on image. If you want to use implemented algorithm for open ai gym and want to change environment for your own, could do something like this: <https://towardsdatascience.com/creating-a-custom-openai-gym-environment-for-stock-trading-be532be3910e>. If need to change env complitely than it is necessary to rewrite your algorithm for your tasks.
  
  
  ---
  
  