Answers.Body: <p>The task you would like to accomplish is referred to as &quot;outpainting&quot;. See example below.</p>
  <p><a href="https://i.sstatic.net/oBKn3.gif" rel="nofollow noreferrer"><img src="https://i.sstatic.net/oBKn3.gif" alt="Enter image description here" /></a></p>
  <p>Very recently, <a href="https://openai.com/blog/dall-e-introducing-outpainting/" rel="nofollow noreferrer">OpenAI</a> released an outpainting feature that extends the possible operations to perform with their diffusion model <a href="https://en.wikipedia.org/wiki/DALL-E" rel="nofollow noreferrer">DALL-E</a>.</p>
  <p>It is also worth to mention the Stability AI <a href="https://github.com/lkwq007/stablediffusion-infinity" rel="nofollow noreferrer">Stable Diffusion</a> model infinity extension (from which I took the example GIF image above). The nice thing of stable diffusion is that, unlike DALL-E, it has been publicly released.</p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2022-09-28T08:20:58.560Z
Answers.LastActivityDate: 2022-09-29T11:33:42.867Z
Answers.LastEditDate: 2022-09-29T11:33:42.867Z
Answers.UserDisplayName: Edoardo Guerriero
Answers.Body: <p>As Edoardo says in <a href="https://ai.stackexchange.com/a/37223/61427">their excellent answer</a>, the task at hand can be approached as an outpainting problem and there's some great tools available to do this.</p>
  <p>To throw an alternative into the ring, I'd point to an example in the field of texture synthesis -  <strong><a href="https://distill.pub/selforg/2021/textures/" rel="noreferrer">Self-Organising Textures</a> built with <a href="https://distill.pub/2020/growing-ca/" rel="noreferrer">Neural Cellular Automata</a>.</strong></p>
  <p>The theory revolves around teaching a very small neural network to generate an image using learned, local update rules. When given a loss function that <a href="https://arxiv.org/abs/1508.06576" rel="noreferrer">compares the style of two images</a>, the model can generate textures that seamlessly extend the original.</p>
  <p>Within the Self-Organising Texture article, there's a <a href="https://colab.research.google.com/github/google-research/self-organising-systems/blob/master/notebooks/texture_nca_pytorch.ipynb" rel="noreferrer">a Google Colab</a> which allows you to import a target image and train the model to reproduce it. I used your image as the target, and it was able to quickly (&lt;20 minutes) make a model that captured the overall pattern of your image:</p>
  <p><a href="https://i.sstatic.net/3tlfI.jpg" rel="noreferrer"><img src="https://i.sstatic.net/3tlfI.jpg" alt="Version of the provided texture recreated and extended by a learned Neural Cellular Automata (NCA) model. That original texture resembles sun-bleached tree roots, thickly interwined and laced together with cobwebs tightly strung between many of them. This reproduction lacks some high quality details such as small twigs in the cobwebs, but overall faithfully reproduces arcs and twists of the original branches." /></a></p>
  <p>There are options for <a href="https://www.youtube.com/watch?v=ZFYZFlY7lgI" rel="noreferrer">refining the resulting texture with different loss functions</a>, and even exerting <a href="https://www.youtube.com/watch?v=i59K8UT9UK4" rel="noreferrer">a degree of artistic control using relative noise levels</a> in the generation process. One of the creators of the models, Alexander Mordvintsev, has an <a href="https://www.youtube.com/c/zzznah" rel="noreferrer">excellent YouTube channel</a> where he walks through some of these techniques and I'd highly recommend checking it out if you want to pursue using this method. Have fun!</p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2022-09-30T11:44:42.023Z
Answers.Text: I've tested the link Colab you put in your reply, and it works great, but how do I change the resolution of the generated pattern ?
Answers.UserDisplayName: Nicola Lepetit
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2022-09-30T15:09:16.667Z
Answers.Text: I'll start by saying that control of these systems is something of an open question! In this case, the biggest resolution bottleneck is when the image is loaded - it's then constrained to 128x128 pixels, meaning that much of the fine detail is never shown to the model. You can change this by upping the value in the imread() call but this will make the training time longer. Alternatively, you could train two separate models, one of the "branches" and one on a zoom in of the "detail" between and use the noise method I linked in my answer to make them work together. Good luck :)
Answers.UserDisplayName: James Ashford
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2022-09-28T23:32:58.130Z
Answers.LastActivityDate: 2022-09-28T23:32:58.130Z
Answers.UserDisplayName: James Ashford
Body: <p>I have created some nice patterns using the <a href="https://midjourney.gitbook.io/docs/" rel="nofollow noreferrer">MidJourney tool</a>. I'd like to find a way to extend these patterns, and I was thinking about an AI tool that takes one of these patterns and extends it in all directions surrounding the original pattern.</p>
  <p>Just to give you an idea, this is one of those patterns:</p>
  <p><a href="https://i.sstatic.net/LvC7f.jpg" rel="nofollow noreferrer"><img src="https://i.sstatic.net/LvC7f.jpg" alt="Enter image description here" /></a></p>
  
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2022-09-29T11:21:19.563Z
Comments.Text: Re *"imagine pattern"*: Do you mean *"image pattern"*?
Comments.UserDisplayName: Peter Mortensen
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2022-09-29T14:35:15.057Z
Comments.Text: @PeterMortensen They may very well have meant "imagine", given that Midjourney has an "imagine" command, as described in the Midjourney page linked to in the question.
Comments.UserDisplayName: NotThatGuy
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2022-09-29T16:38:19.037Z
Comments.Text: @NotThatGuy yes, you are right, it was a mistake due to the /imagine command :-)
Comments.UserDisplayName: Nicola Lepetit
Tags: <ai-design><pattern-recognition><image-generation><diffusion-models>
Title: Using AI to extend an imagine pattern
UserDisplayName: Nicola Lepetit
ThreadText: # Using AI to extend an imagine pattern
  
  (Asked by: username_0 on 2022-09-28)
  
  I have created some nice patterns using the [MidJourney tool](https://midjourney.gitbook.io/docs/). I'd like to find a way to extend these patterns, and I was thinking about an AI tool that takes one of these patterns and extends it in all directions surrounding the original pattern.
  
  Just to give you an idea, this is one of those patterns:
  
  [![Enter image description here](https://i.sstatic.net/LvC7f.jpg)](https://i.sstatic.net/LvC7f.jpg)
  
  **Tags:** ai-design, pattern-recognition, image-generation, diffusion-models
  > **Comments:**
  > **username_1**: Re *"imagine pattern"*: Do you mean *"image pattern"*?  
  > **username_2**: @PeterMortensen They may very well have meant "imagine", given that Midjourney has an "imagine" command, as described in the Midjourney page linked to in the question.  
  > **username_0**: @NotThatGuy yes, you are right, it was a mistake due to the /imagine command :-)  
  
  ---
  
  ## 2 answers
  
  ### Answer by username_4 on 2022-09-28. Score: 15 | Accepted answer
  
  As Edoardo says in [their excellent answer](https://ai.stackexchange.com/a/37223/61427), the task at hand can be approached as an outpainting problem and there's some great tools available to do this.
  
  To throw an alternative into the ring, I'd point to an example in the field of texture synthesis - **[Self-Organising Textures](https://distill.pub/selforg/2021/textures/) built with [Neural Cellular Automata](https://distill.pub/2020/growing-ca/).**
  
  The theory revolves around teaching a very small neural network to generate an image using learned, local update rules. When given a loss function that [compares the style of two images](https://arxiv.org/abs/1508.06576), the model can generate textures that seamlessly extend the original.
  
  Within the Self-Organising Texture article, there's a [a Google Colab](https://colab.research.google.com/github/google-research/self-organising-systems/blob/master/notebooks/texture_nca_pytorch.ipynb) which allows you to import a target image and train the model to reproduce it. I used your image as the target, and it was able to quickly (<20 minutes) make a model that captured the overall pattern of your image:
  
  [![Version of the provided texture recreated and extended by a learned Neural Cellular Automata (NCA) model. That original texture resembles sun-bleached tree roots, thickly interwined and laced together with cobwebs tightly strung between many of them. This reproduction lacks some high quality details such as small twigs in the cobwebs, but overall faithfully reproduces arcs and twists of the original branches.](https://i.sstatic.net/3tlfI.jpg)](https://i.sstatic.net/3tlfI.jpg)
  
  There are options for [refining the resulting texture with different loss functions](https://www.youtube.com/watch?v=ZFYZFlY7lgI), and even exerting [a degree of artistic control using relative noise levels](https://www.youtube.com/watch?v=i59K8UT9UK4) in the generation process. One of the creators of the models, Alexander Mordvintsev, has an [excellent YouTube channel](https://www.youtube.com/c/zzznah) where he walks through some of these techniques and I'd highly recommend checking it out if you want to pursue using this method. Have fun!
  
  > **Comments:**
  > **username_0**: I've tested the link Colab you put in your reply, and it works great, but how do I change the resolution of the generated pattern ?  
  > **username_4**: I'll start by saying that control of these systems is something of an open question! In this case, the biggest resolution bottleneck is when the image is loaded - it's then constrained to 128x128 pixels, meaning that much of the fine detail is never shown to the model. You can change this by upping the value in the imread() call but this will make the training time longer. Alternatively, you could train two separate models, one of the "branches" and one on a zoom in of the "detail" between and use the noise method I linked in my answer to make them work together. Good luck :)  
  
  ---
  
  ### Answer by username_3 on 2022-09-28. Score: 9
  
  The task you would like to accomplish is referred to as "outpainting". See example below.
  
  [![Enter image description here](https://i.sstatic.net/oBKn3.gif)](https://i.sstatic.net/oBKn3.gif)
  
  Very recently, [OpenAI](https://openai.com/blog/dall-e-introducing-outpainting/) released an outpainting feature that extends the possible operations to perform with their diffusion model [DALL-E](https://en.wikipedia.org/wiki/DALL-E).
  
  It is also worth to mention the Stability AI [Stable Diffusion](https://github.com/lkwq007/stablediffusion-infinity) model infinity extension (from which I took the example GIF image above). The nice thing of stable diffusion is that, unlike DALL-E, it has been publicly released.
  
  
  ---
  
  