0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

AIで布地デザイン!Pattern Diffusion × Colabで作る無限模様の世界

0
Posted at

「こんな柄が欲しい」と思ったとき、数分後には手元にある。しかもシームレス。そんな魔法みたいな布地作り、やってみました。


布地デザインはAIの得意分野だった

布地や壁紙、パッケージなどの「模様」って、デザイナーさんが何時間もかけて作るもの。
でも今回試した Pattern Diffusion は、Stable Diffusionをパターン生成専用に鍛えたAIモデル。花柄も幾何学柄も、境界が分からないタイルパターンを数秒で生み出します。

Colabで実際にやってみた

作業は驚くほど簡単。
1 colabを開いてPython 3環境を用意
Google Colab を開く
「ランタイム」→「ランタイムのタイプを変更」で GPU(T4推奨)を選択

2 必要なライブラリのインストール

!pip install diffusers transformers accelerate safetensors pillow

3 モデルの読み込み

from diffusers import StableDiffusionPipeline
import torch

model_id = "Arrexel/pattern-diffusion"

pipe = StableDiffusionPipeline.from_pretrained(
    model_id,
    torch_dtype=torch.float16
).to("cuda")

4 布地の模様を生成(シームレス設定)

このモデルは推論時にtilingパラメータをONにすると継ぎ目なし画像が作れます。

prompt = "floral fabric pattern, seamless, colorful, intricate, repeating"  # 好みで変更
output_path = "fabric_pattern.png"

image = pipe(prompt, height=1024, width=1024, guidance_scale=7.5, tiling=True).images[0]
image.save(output_path)

image

5 画像のダウンロード

from google.colab import files
files.download(output_path)

これでPCに保存して印刷用やデザインに使えます。
今回制作したデザイン↓
fabric_pattern.png

その他にも布地向けのおすすめプロンプト
花柄系

floral fabric pattern, seamless, repeating, watercolor style, pastel colors, soft texture

ダウンロード (2).png

和柄

traditional japanese fabric pattern, indigo and white, seamless, repeating, geometric shapes

ダウンロード (1).png

可愛い系(子供服や雑貨向け)

cute cats and flowers fabric pattern, seamless, repeating, pastel colors, kawaii style

ダウンロード.png

使い道が広がる

・実際の布プリント用デザイン
・ゲームやアプリの背景テクスチャ
・包装紙やポストカード柄
・Webサイトの背景パターン

しかもApache 2.0ライセンスなので、商用利用もOK(クレジット不要)なのは嬉しいポイント。

まとめ

Pattern Diffusionは「無限模様の発生装置」みたいな存在。
手間ゼロ、待ち時間数秒で、自分だけのオリジナル布地柄が作れます。
デザインのスタート地点をAIに任せると、想像以上に面白い結果が返ってきますよ。


フリーランスエンジニアです。
AIや画像生成の記事色々書いているのでプロフィール見てみてください。

もし以下のようなご要望をお持ちでしたらお気軽にご相談ください。
AIサービスを開発したい、ビジネスにAIを組み込んで効率化したい、AIを使ったスマホアプリを開発したい、
ARを使ったアプリケーションを作りたい、スマホアプリを作りたいけどどこに相談したらいいかわからない…

いずれも中間コストを省いたリーズナブルな価格でお請けできます。

お仕事のご相談はこちらまで
rockyshikoku@gmail.com

機械学習やAR技術を使ったアプリケーションを作っています。
機械学習/AR関連の情報を発信しています。
Twitter
Medium
GitHub

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?