Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

French image_prompting intro + json + English new-line fixes #1125

Merged
merged 3 commits into from
Feb 29, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 8 additions & 26 deletions docs/image_prompting/intro.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,28 +4,17 @@ sidebar_position: 1

# 🟢 Introduction

Figuring out the best prompt to create a perfect image is a particular challenge.
Research into methods to do so is not quite as developed as text prompting. This
may be due to inherent challenges in creating objects which are fundamentally subjective
and often lack good accuracy metrics. However, fear not, as the image prompting
community(@parsons2022dalleprompt) has made great discoveries about how to prompt various image models(@rombach2021highresolution)(@ramesh2022hierarchical).

This guide covers basic image prompting techniques, and we highly encourage
that you look at the great resources at the end of the chapter.
Additionally, we provide an example of the end-to-end image prompting process below.
Figuring out the best prompt to create a perfect image is a particular challenge. Research into methods to do so is not quite as developed as text prompting. This may be due to inherent challenges in creating objects which are fundamentally subjective and often lack good accuracy metrics. However, fear not, as the image prompting community(@parsons2022dalleprompt) has made great discoveries about how to prompt various image models(@rombach2021highresolution)(@ramesh2022hierarchical).

This guide covers basic image prompting techniques, and we highly encourage that you look at the great resources at the end of the chapter. Additionally, we provide an example of the end-to-end image prompting process below.

## Example

Here I will go through an example of how I created the images for the front page of this course.
I had been experimenting with low poly style for a deep reinforcement learning
neural radiance field project. I liked the low poly style, and wanted to use it
for this course's images.
Here I will go through an example of how I created the images for the front page of this course. I had been experimenting with low poly style for a deep reinforcement learning neural radiance field project. I liked the low poly style, and wanted to use it for this course's images.

I wanted an astronaut, a rocket, and a computer for the images on the front page.

I did a bunch of research into how to create low poly images, on [r/StableDiffusion](https://www.reddit.com/r/StableDiffusion/)
and other sites, but couldn't find anything super helpful.
I did a bunch of research into how to create low poly images, on [r/StableDiffusion](https://www.reddit.com/r/StableDiffusion/) and other sites, but couldn't find anything super helpful.

I decided to just start with DALLE and the following prompt, and see what happened.

Expand Down Expand Up @@ -73,14 +62,10 @@ Finally, I needed an astronaut! This prompt seemed to do the trick:

I thought the second one was decent.

Now I had an astronaut, a rocket, and a computer. I was happy with them,
so I put them on the front page. After a few days and input from my friends I
realized the style just wasn't consistent 😔.
Now I had an astronaut, a rocket, and a computer. I was happy with them, so I put them on the front page. After a few days and input from my friends I realized the style just wasn't consistent 😔.

I did some more research on [r/StableDiffusion](https://www.reddit.com/r/StableDiffusion/) and found people using the word isometric. I decided to try that out, using Stable Diffusion instead of DALLE. I also realized that I needed to add more modifiers to my prompt to constrain the style. I tried this prompt:

I did some more research on [r/StableDiffusion](https://www.reddit.com/r/StableDiffusion/) and found people using the word isometric. I decided to try that out, using Stable Diffusion instead of DALLE.
I also realized that I needed to add more modifiers to my prompt
to constrain the style. I tried this prompt:
<AIInput>A low poly world, with an astronaut in white suit and blue visor sitting in a sparse green meadow with low poly mountains in the background. Highly detailed, isometric, 4K</AIInput>

<div style={{textAlign: 'center'}}>
Expand Down Expand Up @@ -133,8 +118,7 @@ I liked these, but wanted the stone in the middle of the screen.
<LazyLoadImage className="img-docs" src={gemstone_sd_3} style={{width: "250px"}} />
</div>

Somewhere around here, I used SD's ability to have a previous image provide some influence for future images.
And thus I arrived at:
Somewhere around here, I used SD's ability to have a previous image provide some influence for future images. And thus I arrived at:

<div style={{textAlign: 'center'}}>
<LazyLoadImage className="img-docs" src={focus_final} style={{width: "250px"}} />
Expand All @@ -148,6 +132,4 @@ Finally, I was on to the astronaut.
<LazyLoadImage className="img-docs" src={astronaut_final} style={{width: "250px"}} />
</div>

At this point, I was sufficiently happy with the style consistency between my three images to use them
on the website. The main takeaways for me were that this was a very iterative, research heavy process,
and I had to modify my expectations and ideas as I experimented with different prompts and models.
At this point, I was sufficiently happy with the style consistency between my three images to use them on the website. The main takeaways for me were that this was a very iterative, research heavy process, and I had to modify my expectations and ideas as I experimented with different prompts and models.
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"label": "🖼️ Prompting d'images",
"position": 40,
"link": {
"type": "generated-index",
"description": "Prompt engineering pour les modèles de texte en image comme DALLE et Stable Diffusion !"
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,133 @@
---
sidebar_position: 1
---

# 🟢 Introduction

Déterminer le meilleur prompt pour créer une image parfaite est un défi particulier. La recherche sur les méthodes pour y parvenir n'est pas aussi avancée que le prompting textuel. Cela peut être dû aux défis inhérents à la création d'objets qui sont fondamentalement subjectifs et qui manquent souvent de bons indicateurs de précision. Cependant, n'ayez crainte, car la communauté de prompting d'images(@parsons2022dalleprompt) a réalisé de grandes découvertes sur la manière de prompter divers modèles d'image(@rombach2021highresolution)(@ramesh2022hierarchical).

Ce guide couvre les techniques de base de prompting d'image, et nous vous encourageons vivement à consulter les excellentes ressources à la fin de ce chapitre. De plus, nous fournissons un exemple du processus de prompting d'image de bout en bout ci-dessous.

## Exemple

Ici, je vais vous montrer un exemple de la manière dont j'ai créé les images pour la page d'accueil de ce cours. J'avais expérimenté avec le style low poly pour un projet de champ de radiance neuronal d'apprentissage par renforcement profond. J'aimais le style low poly, et je voulais l'utiliser pour les images de ce cours.

Je voulais un astronaute, une fusée et un ordinateur pour les images de la page d'accueil.

J'ai fait beaucoup de recherches sur la création d'images low poly, sur [r/StableDiffusion](https://www.reddit.com/r/StableDiffusion/) et d'autres sites, mais je n'ai rien trouvé de vraiment utile.

J'ai décidé de commencer avec DALLE et le prompt suivant, pour voir ce qui se passerait.

<AIInput>Fusée low poly blanche et bleue filant vers la lune devant une prairie verte clairsemée</AIInput>

import rockets1 from '@site/docs/assets/images_chapter/rockets_dalle_1.webp';
import rockets2 from '@site/docs/assets/images_chapter/rockets_dalle_2.webp';
import computer_1 from '@site/docs/assets/images_chapter/computer_dalle_1.webp';
import astronaut_1 from '@site/docs/assets/images_chapter/astronaut_dalle_1.webp';
import astronaut_2 from '@site/docs/assets/images_chapter/astronaut_sd_1.webp';
import rocket_sd_1 from '@site/docs/assets/images_chapter/rocket_sd_1.webp';
import rocket_final from '@site/static/img/rocket.webp';
import laptop_sd_1 from '@site/docs/assets/images_chapter/laptop_sd_1.webp';
import gemstone_sd_1 from '@site/docs/assets/images_chapter/gemstone_sd_1.webp';
import gemstone_sd_2 from '@site/docs/assets/images_chapter/gemstone_sd_2.webp';
import gemstone_sd_3 from '@site/docs/assets/images_chapter/gemstone_sd_3.webp';
import focus_final from '@site/static/img/computer.webp';
import astronaut_final from '@site/static/img/astronaut.webp';

<div style={{textAlign: 'center'}}>
<img src={rockets1} className="img-docs" style={{width: "750px"}}/>
</div>

<div style={{textAlign: 'center'}}>
<LazyLoadImage src={rockets2} className="img-docs" style={{width: "750px"}} />
</div>

Je trouvais ces résultats assez bons pour un premier essai ; j'aimais particulièrement la fusée en bas à gauche.

Ensuite, je voulais un ordinateur dans le même style : <AIInput>Ordinateur low poly blanc et bleu posé dans une prairie verte clairsemée</AIInput>

<div style={{textAlign: 'center'}}>
<LazyLoadImage src={computer_1} className="img-docs" style={{width: "750px"}} />
</div>

Enfin, il me fallait un astronaute ! Ce prompt semblait faire l'affaire :

<AIInput>Astronaute low poly blanc et bleu assis dans une prairie verte clairsemée avec des montagnes low poly en arrière-plan</AIInput>

<div style={{textAlign: 'center'}}>
<LazyLoadImage className="img-docs" src={astronaut_1} style={{width: "750px"}} />
</div>

Je trouvais le deuxième assez correct.

Maintenant, j'avais un astronaute, une fusée et un ordinateur. J'en étais satisfait, alors je les ai mis sur la page d'accueil. Après quelques jours et des commentaires de mes amis, je me suis rendu compte que le style n'était tout simplement pas cohérent 😔.

J'ai fait davantage de recherches sur [r/StableDiffusion](https://www.reddit.com/r/StableDiffusion/) et j'ai trouvé des gens utilisant le mot isométrique. J'ai décidé d'essayer cela, en utilisant Stable Diffusion au lieu de DALLE. J'ai aussi réalisé que je devais ajouter plus de modificateurs à mon prompt pour contraindre le style. J'ai essayé ce prompt :

<AIInput>Un monde low poly, avec un astronaute en combinaison blanche et visière bleue assis dans une prairie verte clairsemée avec des montagnes low poly en arrière-plan. Très détaillé, isométrique, 4K</AIInput>

<div style={{textAlign: 'center'}}>
<LazyLoadImage className="img-docs" src={astronaut_2} style={{width: "250px"}} />
</div>

Ces images n'étaient pas géniales, alors j'ai décidé de commencer par la fusée

<AIInput>Un monde low poly, avec une fusée blanche et bleue décollant d'une prairie verte clairsemée avec des montagnes low poly en arrière-plan. Très détaillé, isométrique, 4K</AIInput>

<div style={{textAlign: 'center'}}>
<LazyLoadImage className="img-docs" src={rocket_sd_1} style={{width: "250px"}} />
</div>

Celles-ci n'étaient pas particulièrement bonnes, mais après un peu d'itération ici, je suis arrivé à

<div style={{textAlign: 'center'}}>
<LazyLoadImage className="img-docs" src={rocket_final} style={{width: "250px"}} />
</div>

Maintenant, j'avais besoin d'un meilleur ordinateur portable :

<AIInput>Un monde low poly, avec un ordinateur portable blanc et bleu posé dans une prairie verte clairsemée avec des montagnes low poly en arrière-plan. L'écran est complètement bleu. Très détaillé, isométrique, 4K</AIInput>

<div style={{textAlign: 'center'}}>
<LazyLoadImage className="img-docs" src={laptop_sd_1} style={{width: "250px"}} />
</div>

J'ai obtenu des résultats incohérents ; j'aimais celui en bas à droite, mais j'ai décidé de prendre une direction différente.

<AIInput>Un monde low poly, avec une gemme blanche et bleue lumineuse posée dans une prairie verte clairsemée avec des montagnes low poly en arrière-plan. Très détaillé, isométrique, 4K</AIInput>

<div style={{textAlign: 'center'}}>
<LazyLoadImage className="img-docs" src={gemstone_sd_1} style={{width: "250px"}} />
</div>

Ce n'était pas tout à fait juste. Essayons quelque chose de magique et lumineux.

<AIInput>Un monde low poly, avec une gemme blanche et bleue lumineuse flottant magiquement au milieu de l'écran au-dessus d'une prairie verte clairsemée avec des montagnes low poly en arrière-plan. Très détaillé, isométrique, 4K</AIInput>

<div style={{textAlign: 'center'}}>
<LazyLoadImage className="img-docs" src={gemstone_sd_2} style={{width: "250px"}} />
</div>

Ces images me plaisaient, mais je voulais la pierre au milieu de l'écran.

<AIInput>Un monde low poly, avec une gemme bleue lumineuse flottant magiquement au milieu de l'écran au-dessus d'une prairie verte clairsemée avec des montagnes low poly en arrière-plan. Très détaillé, isométrique, 4K</AIInput>

<div style={{textAlign: 'center'}}>
<LazyLoadImage className="img-docs" src={gemstone_sd_3} style={{width: "250px"}} />
</div>

À peu près à ce moment-là, j'ai utilisé la capacité de SD à influencer les images futures à partir d'images précédentes. Et ainsi, je suis arrivé à :

<div style={{textAlign: 'center'}}>
<LazyLoadImage className="img-docs" src={focus_final} style={{width: "250px"}} />
</div>

Enfin, je suis passé à l'astronaute.

<AIInput>Un monde low poly, avec un astronaute en combinaison blanche et visière bleue assis dans une prairie verte clairsemée avec des montagnes low poly en arrière-plan. Très détaillé, isométrique, 4K</AIInput>

<div style={{textAlign: 'center'}}>
<LazyLoadImage className="img-docs" src={astronaut_final} style={{width: "250px"}} />
</div>

À ce stade, j'étais suffisamment satisfait de la cohérence de style entre mes trois images pour les utiliser sur le site web. Les principales leçons pour moi étaient que c'était un processus très itératif, nécessitant beaucoup de recherche, et j'ai dû modifier mes attentes et idées en expérimentant avec différents prompts et modèles.
Loading