In [1]:
%matplotlib inline
import numpy as np
import cv2
from pathlib import Path
import matplotlib.pyplot as plt

image_path = Path("appa-real/appa-real-release/train")
ignore_list = "appa-real/ignore_list.txt"

with open(ignore_list, "r") as f:
    ignore_image_names = f.readlines()

ignore_image_paths = [str(image_path.joinpath(image_name.strip() + "_face.jpg")) for image_name in ignore_image_names]

In [2]:
def show_imgs(img_paths):
    cols, rows = 5, 3
    img_num = cols * rows
    img_ids = np.random.choice(len(img_paths), img_num, replace=False)

    for i, img_id in enumerate(img_ids):
        plt.subplot(rows, cols, i + 1)
        img = cv2.imread(img_paths[img_id])
        plt.imshow(cv2.cvtColor(img, cv2.COLOR_BGR2RGB))
        plt.axis('off')
    
    plt.show()

In [3]:
show_imgs(ignore_image_paths)



In [ ]: