← Talk overview

Devoxx Belgium 2025 ↗

Mastering Image Generation with Stable Diffusion

Antwerp, Belgium · 2025 · English

Raphaël Semeteys

A practical guide to local and controlled image generation using Stable Diffusion, ComfyUI, embeddings, ControlNet, LoRA, inpainting and identity tools.

If the player is unavailable, use the timestamp links.

Read transcript
  1. 0:00 [Music]
  2. 0:08 Hello everybody.
  3. 0:10 Thanks for coming and listening to me.
  4. 0:13 Yet another talk on AI. Those images we
  5. 0:16 just saw were generated with AI
  6. 0:18 apparently. Let's go visual with AI and
  7. 0:21 speak about image generation with
  8. 0:24 this tool in action with Stable Diffusion
  9. 0:26 and ComfyUI. I want to
  10. 0:29 generate images of yoga poses. Normally
  11. 0:33 my wife should be here next to me
  12. 0:35 because it's a side project of both
  13. 0:37 of us but she couldn't make it
  14. 0:39 unfortunately but in her way she'll be
  15. 0:41 present in the presentation. You will
  16. 0:43 see why.
  17. 0:45 First I'm Raphaël. I work for Worldline
  18. 0:47 for quite a few years. I'm head of DevRel
  19. 0:51 senior architect open source expert.
  20. 0:52 What is important here is I'm also a
  21. 0:54 certified yoga teacher, right? Because
  22. 0:57 okay, Worldline, who knows Worldline
  23. 1:00 in the room just in Belgium.
  24. 1:03 Normally people should know a bit. Yes,
  25. 1:05 we're in the payment industry a major
  26. 1:08 player. We have a lot of engineers.
  27. 1:11 We do R&D including AI and we deal with
  28. 1:14 heavily regulated transactional flow.
  29. 1:17 But this is not the subject. The subject
  30. 1:19 is I'm a yoga teacher and with my
  31. 1:22 wife who is also a yoga teacher a few
  32. 1:25 years back we created this website to
  33. 1:27 share our knowledge on yoga and stuff
  34. 1:29 but he we always had this issue with
  35. 1:31 yoga poses. We wanted them to be
  36. 1:35 precise but we didn't want to use
  37. 1:39 any pictures because it's a lot of
  38. 1:41 hassle. You have to go in the studio and
  39. 1:42 take the pictures and then ah the same
  40. 1:44 t-shirt as the same time a lot of
  41. 1:46 problem. we can't use image from
  42. 1:48 the internet also. So with when GenAI
  43. 1:52 came out like one year ago, we decided
  44. 1:55 to try give it a try. What can we do
  45. 1:57 with AI and generate yoga poses, right?
  46. 2:00 And because I'm a geek, the this these
  47. 2:02 are my functional requirement, right? My
  48. 2:06 non-functional requirement are I want
  49. 2:09 everything to run on this laptop
  50. 2:11 locally. So it's a Nvidia GPU like
  51. 2:16 4070 and only 8 gigabytes of video RAM and
  52. 2:20 that's the limiting factor right and I
  53. 2:23 want the all the component that I will
  54. 2:25 be using to be the more open possible
  55. 2:28 because I'm an open source guy right so
  56. 2:31 this led me very quickly to Stable Diffusion
  57. 2:33 which is a family of open
  58. 2:36 model that were born in Germany in 2021
  59. 2:40 so it's like four decades ago in the
  60. 2:43 GenAI time right they innovated the
  61. 2:46 concept of latent diffusion that I will
  62. 2:48 explain later on very soon they also
  63. 2:51 collaborated with companies Runway,
  64. 2:54 EleutherAI and then Stability AI who
  65. 2:57 finally hired most of the lead
  66. 2:59 developers and now Stability AI is
  67. 3:02 the London-based startup that is the
  68. 3:04 official maintainer of the these models
  69. 3:07 right I said open models because you
  70. 3:10 can You can download them. You can
  71. 3:13 install that. You can even fine-tune the
  72. 3:16 model. But you might have some
  73. 3:18 limitation about what you can do or
  74. 3:20 cannot do with the model. That's
  75. 3:22 why I don't say it's open source. It's
  76. 3:24 open. But this openness allows the rise
  77. 3:27 of a very very dynamic community sharing
  78. 3:30 models, fine-tuned models, tools, tips,
  79. 3:33 tutorials, a lot a lot a lot of dynamism
  80. 3:36 over there. By the way, if you want to
  81. 3:39 understand better what is the difference
  82. 3:42 between open weight model, open data,
  83. 3:44 open science, open source, openness of a
  84. 3:47 model and stuff in this very room.
  85. 3:49 tomorrow I have a talk dedicated on
  86. 3:51 that. Right. So back to image
  87. 3:54 generation. I also selected ComfyUI that is
  88. 3:57 an open source tool this time a GPLv3
  89. 4:00 license that you download and install
  90. 4:02 on your PC. And it is very useful
  91. 4:06 because it puts a UI in front of the
  92. 4:08 workflow that you could build in Python
  93. 4:10 to use Stable Diffusion. It's very
  94. 4:12 intuitive, modular, very customizable.
  95. 4:16 You can do simple or very complex
  96. 4:19 workflow and it's also community based
  97. 4:22 meaning that it's extensible with the
  98. 4:24 notion of custom nodes kind of plugins.
  99. 4:26 There's a lot a lot of people
  100. 4:28 contributing custom nodes. So you can do
  101. 4:30 a lot a lot of things with this tool
  102. 4:32 that becoming more as a platform for me
  103. 4:36 not only a tool and actually some people
  104. 4:38 are running ComfyUI as a service now right
  105. 4:40 now. Okay. So I did selected Stable Diffusion
  106. 4:43 as the model or the
  107. 4:46 family of model and ComfyUI just to do
  108. 4:48 some no code and graphic
  109. 4:52 creation of workflow. But let's start
  110. 4:54 with a demo. So what I did I recorded
  111. 4:57 all the demos on this very PC but then
  112. 5:00 it's recorded because you know demo gods
  113. 5:02 but also because I have to accelerate
  114. 5:04 sometimes the generation time to fit in
  115. 5:07 the 30 minutes and not the presentation
  116. 5:09 to be too boring. Right. So here
  117. 5:13 we are in ComfyUI. I don't know if you can
  118. 5:15 see properly this. Oh yeah it works a
  119. 5:18 little bit. Yeah. So we are in the
  120. 5:21 the UI of ComfyUI right. You can see nodes
  121. 5:24 that I interconnect with links. It's
  122. 5:25 very graphical. All right. So here I
  123. 5:28 connect this node to this other one.
  124. 5:30 Here I in green I have the prompt. In
  125. 5:33 the prompt basically I write what I
  126. 5:36 want. So a girl doing yoga, lotus pose
  127. 5:39 in a park, whatever. There's also a
  128. 5:42 negative prompt. Then it goes to this
  129. 5:45 specific node. We'll go into the details
  130. 5:47 of the node later on. Now I just want to
  131. 5:49 to see this part is not accelerated. So
  132. 5:52 this is the real time right. So you
  133. 5:55 can see the image emerging step by step
  134. 5:58 in the middle node. You can see the
  135. 6:00 consumption of the resource. A lot of
  136. 6:02 VRAM is used. The GPU stuff is broken.
  137. 6:05 Normally there should be also GPU used
  138. 6:07 here in the in the bottom of the screen.
  139. 6:09 And then you see the result. Here we
  140. 6:11 are. I have a girl.
  141. 6:14 She's doing yoga maybe in a park, right?
  142. 6:18 So how does it work? Yeah, as you
  143. 6:21 saw, it's a step-by-step process. It
  144. 6:24 starts with a completely noisy random
  145. 6:26 image like the snow on the TV screen,
  146. 6:28 you know, when there's no signal, right?
  147. 6:30 And then step by step, it will denoise
  148. 6:32 the image, remove the noise and
  149. 6:35 replace it by features that are guided
  150. 6:38 and that want to be aligned with your
  151. 6:40 text prompt. Right? Actually, Stable Diffusion
  152. 6:42 learned to do the other side
  153. 6:44 like how to noise images. And now what
  154. 6:47 he's doing is denoising the images
  155. 6:49 right important part of that is the
  156. 6:52 latent space because even if we you see
  157. 6:55 here all the image appearing step by
  158. 6:57 step it's not how it goes it goes
  159. 7:00 everything is done in a mathematical
  160. 7:02 vectoral multi-dimensional vectoral
  161. 7:05 space pretty much like LLM actually
  162. 7:07 right so it's a compressed version of
  163. 7:10 the image that is represented into this
  164. 7:13 mathematical space and there in this
  165. 7:15 space you have all the matrix
  166. 7:16 calculation. So it's all about GPUs
  167. 7:18 matrix calculation just like LLM, right?
  168. 7:21 So once the image is finished then it's
  169. 7:24 encoded back into pixels. So the model
  170. 7:27 is not working on pixels, it's working
  171. 7:29 on vectoral vectors, vectoral
  172. 7:32 dimensions information, right? Let's
  173. 7:36 focus on a few of the nodes that we
  174. 7:39 saw in our very simple first workflow
  175. 7:42 just to explain just a little bit not
  176. 7:44 too much models right most important
  177. 7:48 part of the stuff obviously so
  178. 7:49 models what will they be there will be
  179. 7:51 files that I download actually it's the
  180. 7:54 weight of the models so the result
  181. 7:56 after the training of the model that I
  182. 7:58 download and I put on my laptop
  183. 8:01 and then with this node I will select
  184. 8:03 the model I want to use and then ComfyUI
  185. 8:06 will load the model into memory and
  186. 8:09 then start using it. Right? The most
  187. 8:11 used model by the community the versions
  188. 8:14 in Stable Diffusion family are Stable Diffusion 1.5
  189. 8:16 and version XL. They have
  190. 8:20 a lot a lot a lot of fine-tuned models
  191. 8:23 that are provided by many many people
  192. 8:25 and communities. You can have some
  193. 8:28 of them on a regular generic website
  194. 8:31 like Hugging Face but you also have a
  195. 8:33 dedicated website to image creation like
  196. 8:36 Civitai and here for instance you have some
  197. 8:38 of the categories that are used on Civitai
  198. 8:41 to you know sort out the model. So we
  199. 8:43 have a lot a lot of things possible
  200. 8:45 right the other node important node
  201. 8:49 here is the prompt okay it's using
  202. 8:51 another model that is called CLIP
  203. 8:53 developed at the same time 2021 by OpenAI
  204. 8:56 right and basically what it will do
  205. 8:59 it will do the correspondence between
  206. 9:01 the text and the features of the image
  207. 9:02 so it understands the prompt and then it
  208. 9:04 will guide the generation right you can
  209. 9:07 have a positive or negative prompt what
  210. 9:09 you want what you don't want in the
  211. 9:11 image and you can have a textual
  212. 9:15 syntax where you make a sentence
  213. 9:17 I want a girl doing yoga sitting
  214. 9:19 cross-legged then with blue hair and
  215. 9:20 blah blah blah blah blah blah or you can
  216. 9:22 have a short syntax with keywords
  217. 9:24 separated by commas and you can put
  218. 9:27 some weight with the with the brackets
  219. 9:29 around to put more weight on a specific
  220. 9:32 keyword right
  221. 9:34 another important node is the KSampler
  222. 9:37 that's where the denoising
  223. 9:39 process occur so you see it's very
  224. 9:42 visual you have a lot of graphics and
  225. 9:44 it's very easy to use but in the
  226. 9:46 background there's Python running
  227. 9:48 obviously especially in this node right
  228. 9:50 so the denoising process is guided by
  229. 9:52 two different kind of algorithm the
  230. 9:54 first one is the sampler that will guide
  231. 9:56 the how the image is the iteration
  232. 10:00 process right the scheduler will
  233. 10:04 control how the noise at each stage is
  234. 10:07 removed so you have a several
  235. 10:10 algorithm possible and you can play with
  236. 10:12 that it will depend also on the model
  237. 10:14 that you use obviously but you have a
  238. 10:17 lot of possibility there you also
  239. 10:19 have other settings that you can
  240. 10:21 tweak them the trick like the number
  241. 10:24 of steps so in how many steps the image
  242. 10:26 is generated so you could think the
  243. 10:29 more step I do the more quality I will
  244. 10:31 have this is not true then it's called
  245. 10:32 overfitting and then the quality can
  246. 10:34 decrease also right you can play with
  247. 10:37 CFG the guidance basically it's the
  248. 10:40 impact of the prompt in into the
  249. 10:42 generation process and you can play with
  250. 10:44 the percentage of denoising. So it's
  251. 10:46 the percentage of the original
  252. 10:49 image that will be removed. Right. Of
  253. 10:52 course if you start with a completely
  254. 10:54 noisy image you'll want to denoise
  255. 10:56 100%. Of course the seed actually is the
  256. 11:00 element the random element that will
  257. 11:02 generate this random image. And there is
  258. 11:05 something that very important to
  259. 11:07 understand here is when you fix the seed
  260. 11:10 and when you fix all the parameters in a
  261. 11:12 workflow the same parameters the same
  262. 11:14 workflow will always generate the same
  263. 11:17 image always. It's pure math. There's no
  264. 11:19 magic. Everything is going on in the
  265. 11:21 latent space. Same parameters, same
  266. 11:24 output, right? And the guys who did ComfyUI
  267. 11:26 are very clever because of that they
  268. 11:29 injected all the workflow information
  269. 11:30 into the EXIF metadata of the image. It
  270. 11:33 means that when you drag and drop an
  271. 11:34 image on a ComfyUI, if it has been
  272. 11:37 generated with ComfyUI, you have the
  273. 11:39 workflow back. So you are able to
  274. 11:40 reproduce the image. Interesting.
  275. 11:43 So okay, in this very first workflow,
  276. 11:46 what can we do? It's a text to image. I
  277. 11:49 put a text description and I have a
  278. 11:51 result. So obviously I can tweak the
  279. 11:53 prompt. So yes, I can change color of
  280. 11:55 the hair, the output, the
  281. 11:59 clothes and stuff. I could go even
  282. 12:02 further if I want to play with the
  283. 12:04 prompt and use textual inversion
  284. 12:06 technique or embeddings. Basically, what
  285. 12:09 are embeddings? It's just a shortcut, a
  286. 12:11 predefined file made by the community
  287. 12:13 or yourself. All right. To orient
  288. 12:17 the prompt, inject a predefined element
  289. 12:20 into the prompt to have a specific
  290. 12:22 action or style, theme, texture,
  291. 12:25 pose, character, anything depending on
  292. 12:27 the embedding file you use. So here for
  293. 12:29 instance I have a list of embedded files
  294. 12:31 with different styles and then I just
  295. 12:34 have to use the keyword in the prompt
  296. 12:36 node in ComfyUI as you see here and then
  297. 12:40 yes the ComfyUI will apply and inject
  298. 12:44 in the prompt all the elements right so
  299. 12:46 it's very tiny file so it's very
  300. 12:49 easy to use and then I fix everything
  301. 12:52 from the previous workflow I
  302. 12:55 only change the embedding files and then
  303. 12:56 you see I definitely have some impact on
  304. 12:59 the style, right? So, it could be
  305. 13:02 fantasy, comic, cinematic and stuff. It
  306. 13:04 just replace prompt that you do like a
  307. 13:06 long a long prompt like that, right? So,
  308. 13:09 it's cool. So, I went back to my to my
  309. 13:12 wife. I say, "Hey, look what I can do."
  310. 13:14 She told me, "Yeah, well, you know,
  311. 13:16 maybe the style is good, but the pose,
  312. 13:18 you don't have any control on that." By
  313. 13:20 the way, lotus pose. The first one, as a
  314. 13:22 yoga teacher, you should know it's not a
  315. 13:24 lotus pose. Yeah, I know. And this one,
  316. 13:26 the tree. Maybe it's because there's a
  317. 13:28 tree in the back. I don't know. The
  318. 13:30 other one, the camel one. I don't know.
  319. 13:31 Maybe it's a bias because she looks
  320. 13:34 like oriental. I don't know. Camel
  321. 13:36 oriental. I don't know. And the last one
  322. 13:38 is completely hallucination. It's not
  323. 13:39 the shoulder stand pose. And don't try
  324. 13:41 to do that. Actually, it's not a good
  325. 13:43 one. Right. So, basically text to image
  326. 13:45 for my use case is not enough. So, what
  327. 13:47 should we do? Move. Generate an image of
  328. 13:49 a woman based on an existing image. I
  329. 13:52 have to give something as an input and
  330. 13:54 maybe to control a bit more the output.
  331. 13:56 Right? So that's what I did here. I just
  332. 13:58 update my workflow and I put an image of
  333. 14:01 myself doing a specific posture. All
  334. 14:04 right. Here you can see
  335. 14:08 if I zoom on the prompt, I
  336. 14:11 still ask for a girl doing yoga and with
  337. 14:14 blue pants. I want her to have blue
  338. 14:15 pants, right? So it's an image of me.
  339. 14:17 I'm a man supposedly and I want I
  340. 14:20 want a girl to be generated. So, let's
  341. 14:22 see how it goes here. Okay, you can see
  342. 14:25 yes, the pose is okay, but I think
  343. 14:28 her name must be Raphaela. She really
  344. 14:30 looks like me as a girl. Let's play with
  345. 14:34 denoising. This time I say I want to denoise
  346. 14:35 only 70%, because in the first
  347. 14:38 pass I did 55%. Why? Because if I put
  348. 14:41 100%, of course the whole input
  349. 14:44 image has no purpose, right? So you can
  350. 14:46 see here it's nice. I can have control
  351. 14:48 on the pose. But if I play with the
  352. 14:51 denoising, maybe you didn't notice, but I
  353. 14:52 did because I am a yoga teacher. And
  354. 14:54 the head is tilted. It's not in the axis
  355. 14:56 of the spine. So that's not the right
  356. 14:58 pose. Not happy, right? So I was kind of
  357. 15:02 you know bit disappointed. How
  358. 15:05 could we do what would be interesting if
  359. 15:07 I could extract only the element of the
  360. 15:10 pose from the image not the style not
  361. 15:12 the fact that I'm on the on this mat and
  362. 15:15 with the background and stuff and
  363. 15:18 inject that into the latent space and
  364. 15:20 that exactly what the ControlNets are
  365. 15:23 there are special specialized neural
  366. 15:25 networks that will help to extract
  367. 15:28 certain aspect from the image and just
  368. 15:31 use that and send it to the latent
  369. 15:33 space. So you have different control
  370. 15:35 methods depending on the ControlNet.
  371. 15:37 Can be structural, the texture, the
  372. 15:39 contents, the abstract, etc. Let's have
  373. 15:42 an example here. I update my workflow.
  374. 15:45 The new nodes are in the blue box here.
  375. 15:48 So I still want a girl with white
  376. 15:50 t-shirt, whatever, whatever. So I have
  377. 15:52 the description of what I want. Here
  378. 15:54 are the nodes related to the ControlNet.
  379. 15:56 The image will go into a
  380. 15:57 pre-processor that will do some image
  381. 16:00 processing like here in this case inject
  382. 16:03 extract depth information from the
  383. 16:05 image and then inject that into the
  384. 16:07 generation process. You can see the depth
  385. 16:09 image here that will be used here. Now I
  386. 16:12 accelerate things a little bit. Now it
  387. 16:14 will be quicker. It's in 20 steps. And
  388. 16:17 here I have the result. Yes. Now the
  389. 16:20 pose is okay. The background is a little
  390. 16:22 bit funky. Let's play with the denoising
  391. 16:25 value because I want to see how
  392. 16:27 stable the image is. All right, so I
  393. 16:29 put 75%.
  394. 16:31 Okay, the background is okay. The pose
  395. 16:33 is still okay. Let's play with the
  396. 16:35 prompt. Let's say I want the girl to be
  397. 16:37 blonde just to see if when she's blonde,
  398. 16:39 the pose is different or not. And I
  399. 16:43 tweak a bit also the denoising
  400. 16:44 value. I say let's put 80%. All right.
  401. 16:49 and
  402. 16:51 accelerated again with my 8 gigabyte
  403. 16:54 memory. Here we go. So yes, basically
  404. 16:57 now I have control on the pose. And
  405. 17:01 by the way, you have different kind of
  406. 17:03 pre-processors. It can be edge
  407. 17:05 detection, color map, scribble, and
  408. 17:07 whatever. The OpenPose one was
  409. 17:09 promising but not strong enough for
  410. 17:12 yoga poses. It's more like for classical
  411. 17:14 pose, you know, that kind of stuff, not
  412. 17:16 for my use case. But I discovered that
  413. 17:18 because you can stack the
  414. 17:21 context, you can use several
  415. 17:24 by using both edge detection and depth
  416. 17:27 then I had a good control on the
  417. 17:29 pose. Right? So because I can do that
  418. 17:32 abstract the pose from the image, I can
  419. 17:34 use abstract images. This is good
  420. 17:36 because this is the method I was using
  421. 17:38 before for my website. I use these tools
  422. 17:41 JustSketchMe. It's basically a virtual
  423. 17:43 mannequin, you know. So you make the
  424. 17:46 pose you want and then you can have the
  425. 17:48 angle the view that you want because
  426. 17:50 it's 3D so you export it right. So just
  427. 17:53 update the workflow and this time I put
  428. 17:57 the abstract image as an input. I
  429. 17:59 changed the model I use Juggernaut which
  430. 18:01 is a fine tuned version of SDXL. This
  431. 18:04 time I have my two ControlNet for depth
  432. 18:07 and edges. All right. So obviously
  433. 18:11 the more nodes you add the more
  434. 18:13 parameters you have to play with it can
  435. 18:15 be a little bit dizzy here you see the
  436. 18:18 features edges and depth has been
  437. 18:21 extracted and then yes I have this
  438. 18:22 result okay that is good I have control
  439. 18:25 on the pose and I have control on the
  440. 18:26 style for the prompt very happy I go
  441. 18:30 back to my wife I say job done I mean
  442. 18:33 requirement fulfilled she say yeah yeah
  443. 18:35 yeah that's very good but you know on
  444. 18:38 the website we do sequences, right and
  445. 18:41 so we have sequences it's the same
  446. 18:43 girl that should do the poses so she
  447. 18:45 has to have the same face I say
  448. 18:48 but that's that was not in the initial
  449. 18:50 requirement you really like customer you
  450. 18:52 know like never know so I was like geez
  451. 18:55 man and then I thought and I say okay
  452. 18:58 okay let's stay motivated and I
  453. 19:01 know that people generate deep fakes you
  454. 19:03 know of celebrities so it's possible to
  455. 19:06 enforce the face of somebody
  456. 19:08 all right so let's look into this
  457. 19:10 direction. That's how I discovered
  458. 19:11 LoRA. So LoRA is for low rank
  459. 19:14 adaptation. Basically, if you in plain
  460. 19:17 word, it's an update of the model at
  461. 19:19 runtime. All right, it has been
  462. 19:21 pre-trained only to change small part of
  463. 19:24 the model and at the runtime when you
  464. 19:25 use the specific keyword, the patch will
  465. 19:28 be applied and then it has been trained
  466. 19:31 to do different kind of stuff like
  467. 19:33 styles, pose, characters or concept.
  468. 19:36 Here you can see the style different
  469. 19:38 LoRA on the same workflow. But what
  470. 19:41 interesting me is the character. All
  471. 19:43 right. So let's test it. Very very
  472. 19:46 simple workflow. Here in the yellow I
  473. 19:49 have downloaded a lot of LoRA file. So
  474. 19:52 I select one a celebrity a mysterious
  475. 19:54 one. We'll see if we recognize her. The
  476. 19:58 prompt. Okay. I put the specific keyword
  477. 20:00 to activate the LoRA at runtime. And
  478. 20:02 then yes. And then I use a ControlNet
  479. 20:05 but with a strength of only 10% because
  480. 20:07 I don't want to constraint too much the
  481. 20:09 LoRA because I really want how good it
  482. 20:11 is to generate the face of the
  483. 20:12 celebrity. Right? So let's see.
  484. 20:15 All right. Here she so I don't know if
  485. 20:17 you recognize her but in the name of the
  486. 20:19 LoRA, Scarlett is in it maybe. And by
  487. 20:22 changing just the file I can have a Emma
  488. 20:25 or a Megan right. So you see the pose
  489. 20:27 changes because it's only 10% on the
  490. 20:29 ControlNet. So you always have a
  491. 20:30 trade-off and you have to play a lot of
  492. 20:32 with a lot of parameters. But with that
  493. 20:34 yes okay then I can do that very
  494. 20:37 easily. I don't even showing you the
  495. 20:39 video. I just add my LoRA here and
  496. 20:42 then the result I have a control on the
  497. 20:44 pose and on the face. So there I go back
  498. 20:47 to my wife and I say yay job done. Now I
  499. 20:50 can decorate both face pose and
  500. 20:53 style. So I have the variation and then
  501. 20:56 I can have the homogeneity. Then here is
  502. 20:59 your sequence and there is another one.
  503. 21:02 So I was kind of excited and she looked
  504. 21:04 at me say yeah yeah that's good. I say
  505. 21:05 what's going on? Say Scarlett won't be
  506. 21:07 happy about that. I say I know but
  507. 21:10 well it's not really looking like. So
  508. 21:13 there's a trick. Oh you could put 50% of
  509. 21:17 Scarlett and then 20% of Megan and then
  510. 21:21 you know 30% of Emma right. They said no
  511. 21:24 no no you know it's not proper. we have
  512. 21:26 to do our own LoRA. So I tried that.
  513. 21:29 Okay. First thing on online in a SaaS
  514. 21:32 mode with Google Colab with the
  515. 21:35 DreamBooth technique. The result were
  516. 21:38 not that good. Actually my wife was not
  517. 21:40 happy at all because she asked me who is
  518. 21:42 this ugly girl. I say it's supposed to
  519. 21:43 be you because so she was not happy. I
  520. 21:46 read okay back to my initial NFR. Let's
  521. 21:49 do everything locally. I changed the
  522. 21:51 strategy using Kohya_ss open source
  523. 21:55 framework to do that and I injected
  524. 21:58 less images but more epochs then I
  525. 22:02 got this result. So with this result,
  526. 22:04 yes, I can update now my workflow
  527. 22:07 and I have a interesting image.
  528. 22:10 By the way, I added a node here
  529. 22:12 specialized with a associated model just
  530. 22:14 to remove the background, right? It's
  531. 22:16 just to show you that you can do more
  532. 22:18 and more complex workflow. I'm just
  533. 22:20 staying on very simple one here. So with
  534. 22:22 that, yes, I can have the sequence.
  535. 22:24 and when I was going to my retro, I
  536. 22:27 mean to the meeting with my wife, right?
  537. 22:30 And say in my mind I was like the
  538. 22:33 quality is not that good. I mean maybe I
  539. 22:35 should have trained more and I preferred
  540. 22:37 the Scarlett LoRA. This one is not very
  541. 22:39 good. But she killed the solution
  542. 22:41 definitely when she asked me. Okay
  543. 22:42 that's nice. Let me see what
  544. 22:45 it does when you use
  545. 22:47 Cheyenne. Cheyenne is a model that is
  546. 22:49 specialized to generate comics
  547. 22:52 graphic novel style. And I say do you
  548. 22:53 have three hour and a half because I
  549. 22:55 have to go back and train everything you
  550. 22:56 know because it depends on the model.
  551. 22:58 And she told me, "Raphaël, it's
  552. 23:01 not possible. It's not realistic." All
  553. 23:02 right. So I looked again and I
  554. 23:05 said, "Okay, are there models techniques
  555. 23:07 specialized on facial identities?"
  556. 23:09 That's how I discovered FaceID. FaceID
  557. 23:12 is a image prompt adapter. It's another
  558. 23:14 technique. You can see it very basically
  559. 23:17 as a one-image LoRA at
  560. 23:20 runtime this time. So just one picture
  561. 23:23 that you inject and FaceID is
  562. 23:26 specialized in facial recognition.
  563. 23:28 All right. So I also discovered in
  564. 23:31 while looking for it FaceDetailer which
  565. 23:34 is a different kind of model because
  566. 23:35 it's a post-processing AI model that is
  567. 23:38 specifically trained to enhance facial
  568. 23:41 features like nose, lips, facial
  569. 23:43 expression and stuff like that. Right?
  570. 23:45 So let's update the workflow. And this
  571. 23:47 is the final workflow for my use
  572. 23:49 case. Here you see the yellow boxes are
  573. 23:52 new. I have a big one but it's the blue
  574. 23:55 one is for the ControlNet. Now I really
  575. 23:57 focused on the facial identity. Here the
  576. 23:59 is image of my wife. Here the model you
  577. 24:02 have several version as soon as you use
  578. 24:04 IP Adapter and another component. You
  579. 24:06 have a lot of parameters that you can
  580. 24:08 tweak on the strength when it starts
  581. 24:10 when it stop and stuff like that. Here
  582. 24:12 on the side I have a Juggernaut
  583. 24:16 model. I use also LoRA but it's just to
  584. 24:18 change the style. I could have dropped
  585. 24:20 this one right and then here in the blue
  586. 24:23 box you have my the two ControlNet I
  587. 24:25 just reorganized the workflow for
  588. 24:27 readability but that's all right so
  589. 24:29 let's run everything you see pose
  590. 24:31 element are extracted now things are
  591. 24:35 going on accelerating a little bit then
  592. 24:39 I have the result here so good thing but
  593. 24:42 it's not finished because now the result
  594. 24:44 of this first generation is sent to
  595. 24:46 FaceDetailer right you see FaceDetailer
  596. 24:48 is also linked with FaceID. It
  597. 24:51 means that it will enhance the features
  598. 24:53 based on the initial image of my wife
  599. 24:55 which is very good. Here's the result.
  600. 24:57 You see on the top you have this white
  601. 25:00 box. There's a model that detect
  602. 25:02 the zone of the image where the face is
  603. 25:04 and it will change only that which is
  604. 25:06 good because I don't want it to do
  605. 25:08 anything else. And here I have a node
  606. 25:09 before after. I don't know if you can
  607. 25:11 see properly. I zoom a little bit before
  608. 25:14 after. So the quality is better with
  609. 25:16 FaceDetailer. With that I'm okay. I said,
  610. 25:18 "Yes, job done." Job done this time.
  611. 25:20 Yes, I'm sure. So, I went to my wife. I
  612. 25:23 say, "Hey, here we are. I appreciate."
  613. 25:25 Yes, Raphaël, that's fine. We're okay. I
  614. 25:27 say, "Yeah, okay. Peace at home. It's
  615. 25:30 very nice. And I'm happy. The quality is
  616. 25:32 better. It's very and I don't
  617. 25:36 need to train anything. It's just a
  618. 25:37 simple workflow. I'm very, very happy.
  619. 25:39 And by the way, I can change the model
  620. 25:41 this time. And the same workflow, same
  621. 25:44 parameters. I just change the model,
  622. 25:45 tweak a little bit the things. And then
  623. 25:47 I have a completely different style. But
  624. 25:49 I still have control on the pose. It's
  625. 25:51 still looking kind of like her but in a
  626. 25:53 cartoon style. Right? So here we go. And
  627. 25:56 by the way, because it's only one image,
  628. 25:58 I can also change persona and put an
  629. 26:01 image of myself. Right? And then it does
  630. 26:04 that. Well, I have to admit, at least
  631. 26:06 for me, not for my wife, of course, AI
  632. 26:09 tends to think I am still the young guy
  633. 26:11 I was when I started yoga many, many
  634. 26:13 years ago. But whatever that's not the
  635. 26:15 point because yes I can do sequencing
  636. 26:17 with that. So I'm very happy. What did
  637. 26:20 we learn to summarize if you want to
  638. 26:24 tweak images have
  639. 26:27 some creativity just with prompt and
  640. 26:29 text to image you can do things but if
  641. 26:31 you want to control more aspect of the
  642. 26:33 images you have to input something
  643. 26:37 like images. So you can do image to
  644. 26:39 image but it's a little bit raw a little
  645. 26:41 bit gross. If you want to be more
  646. 26:42 subtle, ControlNet helps you by
  647. 26:45 extracting some elements only and
  648. 26:47 sending them to the into the latent
  649. 26:49 space. LoRA for facial identity and
  650. 26:52 coherence is okay, but it's a lot of
  651. 26:55 work. It's heavy and finally the result
  652. 26:57 the quality not okay at least in my case
  653. 27:00 but with IP FaceID I mean and
  654. 27:04 FaceDetailer yes I was able to do
  655. 27:07 something good. So to summarize
  656. 27:11 my use case is implementable actually
  657. 27:14 implemented we actually publish
  658. 27:17 because we used to publish a yoga
  659. 27:19 sequence in the yoga journal in French
  660. 27:21 in France whatever and why not
  661. 27:23 this sequence was generated by AI
  662. 27:26 the journal owner was so so excited
  663. 27:29 about that. All right. So, we did so we
  664. 27:31 have accurate and consistent images of
  665. 27:34 poses and sequences, right? And what
  666. 27:38 I've learned it's image generation is
  667. 27:40 both a science and an art. It's a
  668. 27:42 science because as you said, as you as I
  669. 27:44 told you, I mean, same parameters, same
  670. 27:47 image. It's only mathematical operation
  671. 27:50 there. But the more nodes and the more
  672. 27:53 component you add in your workflow, the
  673. 27:54 more parameters you have and then you're
  674. 27:56 lost, you know. So by trial and error
  675. 27:59 and you develop a certain sixth sense of
  676. 28:01 thing and then you say oh that's the
  677. 28:03 LoRA oh no that's the embedding you
  678. 28:05 know because my wife sometimes she
  679. 28:06 how do you know I feel it's like that so
  680. 28:08 it's also an art in that matter
  681. 28:12 icing on the cake by changing a few
  682. 28:14 elements changing a LoRA or prompt and
  683. 28:17 and stuff that was not in the initial
  684. 28:20 requirement that's a new feature you
  685. 28:22 can deal with inclusivity very very
  686. 28:24 easily with that kind of workflow
  687. 28:26 Okay.
  688. 28:29 we started that one year ago. In the
  689. 28:31 meantime, a lot of things changed in
  690. 28:34 AI with the rise of new models like
  691. 28:37 multimodal models. So, I was like, how
  692. 28:39 do they stand regarding my use case? So,
  693. 28:41 I did try ChatGPT with GPT-Image-1,
  694. 28:45 Nano Banana in Google or Flux in
  695. 28:49 Black Forest Labs. For the test I
  696. 28:52 did. It's not perfect yet, but it's
  697. 28:54 going very very quickly because you
  698. 28:56 don't have the same level of control
  699. 28:57 basically, you know, the ControlNet,
  700. 28:59 the IP Adapter and stuff. So I can't
  701. 29:01 have both control on the pose and the
  702. 29:03 face. For instance, the first image,
  703. 29:05 never do that. It's not good for your
  704. 29:06 neck, right? The second one, Nano Banana
  705. 29:10 told me that my wife was a
  706. 29:12 celebrity. I didn't know that. So I'm
  707. 29:13 very happy married to a celebrity. So he
  708. 29:16 refused to generate a face, right? But
  709. 29:19 what they are very good at is
  710. 29:21 editing feature. As soon as you generate
  711. 29:23 the image, it's very easy to change. For
  712. 29:25 instance, here I change the format. I
  713. 29:27 changed the color and I said put Devoxx on
  714. 29:29 the t-shirt of the girl
  715. 29:31 doing yoga. Very very powerful, right?
  716. 29:33 So a lot of amazing thing. Speaking
  717. 29:36 about the future, what could be next
  718. 29:38 video? What is video except a sequence
  719. 29:40 of images, right? So I tried ComfyUI
  720. 29:43 locally with Wan from Alibaba a video
  721. 29:46 generation model and I feed the model
  722. 29:48 with three images generated by the
  723. 29:50 previous workflow and I told him
  724. 29:52 generate the sequence between the
  725. 29:54 images. So here's the result after
  726. 29:55 many hours of computing on this. So here
  727. 29:59 second pose. Yes. Yeah. She's happy. You
  728. 30:02 see? Yes. Yeah. Right. So yeah that's
  729. 30:05 possible. And just to wrap everything up
  730. 30:08 something that's why I called
  731. 30:10 this presentation the yoga of image
  732. 30:12 generation because Yoga Sutras is a very
  733. 30:15 important text in yoga
  734. 30:18 and one of the sutra says the pose to
  735. 30:22 meditate to do yoga should be stable
  736. 30:25 like Stable Diffusion and comfortable as
  737. 30:28 ComfyUI. I was like was it on purpose?
  738. 30:31 I don't know. My mind was blown really.
  739. 30:35 All right. Thank you very much. I hope
  740. 30:37 that you learned a few things. If you
  741. 30:39 want to get in touch with me, use the
  742. 30:42 first QR code and please feedback
  743. 30:44 is a gift. Give me some feedback on
  744. 30:47 this very presentation with the second
  745. 30:49 QR code. Right. Thank you very much.
Watch on the original platform ↗
Slide 1 of —

Loading slides…