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?

Albumentationsを用いたデータ拡張(Data Augmentation)

Posted at

Albumentationsの基本トピック

Albumentationsの概要とインストール

Albumentationsは画像のデータ拡張(Data Augmentation)を行うにあたって用いられる高速かつフレキシブルなライブラリです。下記のコマンドを実行することによってPyPIからインストールすることが可能です。

$ pip install -U albumentations

pip installのオプションでつけた-Uはライブラリがインストール済みだった場合に最新版にアップデートするオプションです。

Albumentationsのサンプルコードの実行

・元画像
2007_000256.jpg

import random

import cv2
from matplotlib import pyplot as plt

import albumentations as A


image = cv2.imread('images/2007_000256.jpg')
image = cv2.cvtColor(image, cv2.COLOR_BGR2RGB)

transform = A.HorizontalFlip(p=0.5)
random.seed(7)
augmented_image = transform(image=image)['image']

plt.imsave("results/output1.png", augmented_image)

・実行結果
output1.png

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?