top of page

人工知能で画像描画。Google ColabでStable Diffusion。

最近流行の人工知能絵画。

ローカルマシンではGPUが不足しているため、Google ColabでStable Diffusionを試してみました。


環境構築は下記サイトが最も分かりやすく、10分ほどで構築出来ました。PCのスペックを問わないのでお勧めです。





漫画や映画、好きな絵画の世界観を簡単に表現する方法の一つとして、呪文と呼ばれるプロンプトの最後に、【"by MAKOTO SHINKAI"】などの有名作家・芸術家の名前を入れる方法があります。


以下は、【人工知能の美しいコンセプトアート】をby ○○の様に入力して作画された例です。


有名作家・芸術家ごとに紹介します。



 

【人工知能の美しいコンセプトアート】


田徹也

Beautiful concept art of Artificial Intelligence by TETSUYA ISHIDA



海誠

Beautiful concept art of Artificial Intelligence by MAKOTO SHINKAI




井守

Beautiful concept art of Artificial Intelligence by MAMORU OSHII





山明

Beautiful concept art of Artificial Intelligence by AKIRA TORIYAMA




樫 義博

Beautiful concept art of Artificial Intelligence by YOSHIHIRO TOGASHI




ェームズ・フランシス・キャメロン

Beautiful concept art of Artificial Intelligence by James Francis Cameron





ブロ・ルイス・ピカソ

Beautiful concept art of Artificial Intelligence by Pablo Ruiz Picasso





ィンセント・ヴィレム・ファン・ゴッホ

Beautiful concept art of Artificial Intelligence by Vincent Willem van Gogh





飾北斎

Beautiful concept art of Artificial Intelligence by HOKUSAI KATSUSHIKA





Beautiful concept art of Artificial Intelligence by GOD



この様にby ○○とするだけで、著名作家の世界観が楽しめます。凄いです。

誰でも簡単に人工知能に触れられる時代になりました。


これからは「人工知能を作成する仕事」という時代から、「人工知能を操る仕事」という時代へと変遷していくかもしれません。シンギュラリティに期待です。



統計や数理最適化の結晶である人工知能がどこまで発展するのか、未来に行って覗いてみたいものです。



python コード👇


!pip install diffusers==0.2.4 transformers scipy ftfy

YOUR_TOKEN="ここにあなたのアクセスコードを入力してください"

from diffusers import StableDiffusionPipeline
pipe = StableDiffusionPipeline.from_pretrained("CompVis/stable-diffusion-v1-4", use_auth_token=YOUR_TOKEN)
pipe.to("cuda")

import os
os.chdir("/content/drive/MyDrive/StableDiffusion")

import datetime
import pytz
import re

prompt = "Beautiful concept  art of Artificial Intelligence by GOD"#@param {type:"string"}
filename = "AI" #@param {type:"string"}
now = datetime.datetime.now(pytz.timezone('Asia/Tokyo'))
date = now.strftime('%Y-%m-%d-%H-%M-%S')
#filename = re.sub(r'[\\/:*?"<>|,]+', '', prompt).replace(' ','_')
outputfile = filename + '_' + date + '.png'
image = pipe(prompt, num_inference_steps=50)["sample"][0]
image.save(outputfile)

image


閲覧数:140回0件のコメント
bottom of page