Merge pull request 'create test set' (#2) from test_set into main
Reviewed-on: #2
41
load_test_data.py
Normal file
@ -0,0 +1,41 @@
|
|||||||
|
import numpy as np
|
||||||
|
import os
|
||||||
|
from skimage.io import imread
|
||||||
|
import cv2 as cv
|
||||||
|
from pathlib import Path
|
||||||
|
|
||||||
|
|
||||||
|
def load_data(input_dir, newSize=(64,64)):
|
||||||
|
image_path = Path(input_dir)
|
||||||
|
file_names = os.listdir(image_path)
|
||||||
|
categories_name = []
|
||||||
|
categories_count = []
|
||||||
|
count = 0
|
||||||
|
n = file_names[0]
|
||||||
|
for name in file_names:
|
||||||
|
if name != n:
|
||||||
|
categories_count.append(count)
|
||||||
|
n = name
|
||||||
|
count = 1
|
||||||
|
else:
|
||||||
|
count += 1
|
||||||
|
if not name in categories_name:
|
||||||
|
categories_name.append(name)
|
||||||
|
categories_count.append(count)
|
||||||
|
test_img = []
|
||||||
|
labels = []
|
||||||
|
|
||||||
|
for n in file_names:
|
||||||
|
p = image_path / n
|
||||||
|
img = imread(p) # zwraca ndarry postaci xSize x ySize x colorDepth
|
||||||
|
img = cv.resize(img, newSize, interpolation=cv.INTER_AREA) # zwraca ndarray
|
||||||
|
img = img / 255 # type: ignore #normalizacja
|
||||||
|
test_img.append(img)
|
||||||
|
labels.append(n)
|
||||||
|
|
||||||
|
X = {}
|
||||||
|
X["values"] = np.array(test_img)
|
||||||
|
X["name"] = categories_name
|
||||||
|
X["names_count"] = categories_count
|
||||||
|
X["labels"] = labels
|
||||||
|
return X
|
BIN
test_set/Ackerman, Mikasa.jpg
Normal file
After Width: | Height: | Size: 73 KiB |
BIN
test_set/Aisaka, Taiga.jpg
Normal file
After Width: | Height: | Size: 69 KiB |
BIN
test_set/Alucard.jpg
Normal file
After Width: | Height: | Size: 9.9 KiB |
BIN
test_set/Araragi, Koyomi.jpg
Normal file
After Width: | Height: | Size: 53 KiB |
BIN
test_set/Ayanokouji, Kiyotaka.jpg
Normal file
After Width: | Height: | Size: 167 KiB |
BIN
test_set/Dazai, Osamu.jpg
Normal file
After Width: | Height: | Size: 74 KiB |
BIN
test_set/Elric, Edward.jpg
Normal file
After Width: | Height: | Size: 47 KiB |
BIN
test_set/Emilia.jpg
Normal file
After Width: | Height: | Size: 116 KiB |
BIN
test_set/Evergarden, Violet.jpg
Normal file
After Width: | Height: | Size: 112 KiB |
BIN
test_set/Gasai, Yuno.jpg
Normal file
After Width: | Height: | Size: 67 KiB |
BIN
test_set/Gojou, Satoru.jpg
Normal file
After Width: | Height: | Size: 455 KiB |
BIN
test_set/Guts.jpg
Normal file
After Width: | Height: | Size: 90 KiB |
BIN
test_set/Hatake, Kakashi.jpg
Normal file
After Width: | Height: | Size: 187 KiB |
BIN
test_set/Hikigaya, Hachiman.jpg
Normal file
After Width: | Height: | Size: 36 KiB |
BIN
test_set/Joestar, Joseph.jpg
Normal file
After Width: | Height: | Size: 56 KiB |
BIN
test_set/Kamina.jpg
Normal file
After Width: | Height: | Size: 73 KiB |
BIN
test_set/Kaneki, Ken.jpg
Normal file
After Width: | Height: | Size: 97 KiB |
BIN
test_set/Kirigaya, Kazuto.jpg
Normal file
After Width: | Height: | Size: 35 KiB |
BIN
test_set/Kurosaki, Ichigo.jpg
Normal file
After Width: | Height: | Size: 136 KiB |
BIN
test_set/Lamperouge, Lelouch.jpg
Normal file
After Width: | Height: | Size: 114 KiB |
BIN
test_set/Lawliet, L.jpg
Normal file
After Width: | Height: | Size: 53 KiB |
BIN
test_set/Levi.jpg
Normal file
After Width: | Height: | Size: 74 KiB |
BIN
test_set/Makise, Kurisu.jpg
Normal file
After Width: | Height: | Size: 100 KiB |
BIN
test_set/Megumin.jpg
Normal file
After Width: | Height: | Size: 243 KiB |
BIN
test_set/Monkey D., Luffy.jpg
Normal file
After Width: | Height: | Size: 48 KiB |
BIN
test_set/Morow, Hisoka.jpg
Normal file
After Width: | Height: | Size: 114 KiB |
BIN
test_set/Mustang, Roy.jpg
Normal file
After Width: | Height: | Size: 46 KiB |
BIN
test_set/Okabe, Rintarou.jpg
Normal file
After Width: | Height: | Size: 108 KiB |
BIN
test_set/Onizuka, Eikichi.jpg
Normal file
After Width: | Height: | Size: 239 KiB |
BIN
test_set/Oshino, Shinobu.jpg
Normal file
After Width: | Height: | Size: 814 KiB |
BIN
test_set/Reigen, Arataka.jpg
Normal file
After Width: | Height: | Size: 138 KiB |
BIN
test_set/Rem.jpg
Normal file
After Width: | Height: | Size: 145 KiB |
BIN
test_set/Roronoa, Zoro.jpg
Normal file
After Width: | Height: | Size: 84 KiB |
BIN
test_set/Saber.jpg
Normal file
After Width: | Height: | Size: 195 KiB |
BIN
test_set/Saitama.jpg
Normal file
After Width: | Height: | Size: 155 KiB |
BIN
test_set/Sakata, Gintoki.jpg
Normal file
After Width: | Height: | Size: 7.3 KiB |
BIN
test_set/Sakurajima, Mai.jpg
Normal file
After Width: | Height: | Size: 33 KiB |
BIN
test_set/Sanji.jpg
Normal file
After Width: | Height: | Size: 338 KiB |
BIN
test_set/Senjougahara, Hitagi.jpg
Normal file
After Width: | Height: | Size: 73 KiB |
BIN
test_set/Spiegel, Spike.jpg
Normal file
After Width: | Height: | Size: 496 KiB |
BIN
test_set/Uchiha, Itachi.jpg
Normal file
After Width: | Height: | Size: 52 KiB |
BIN
test_set/Uchiha, Sasuke.jpg
Normal file
After Width: | Height: | Size: 41 KiB |
BIN
test_set/Uzumaki, Naruto.jpg
Normal file
After Width: | Height: | Size: 492 KiB |
BIN
test_set/Yagami, Light.jpg
Normal file
After Width: | Height: | Size: 5.4 KiB |
BIN
test_set/Yato.jpg
Normal file
After Width: | Height: | Size: 96 KiB |
BIN
test_set/Yeager, Eren.jpg
Normal file
After Width: | Height: | Size: 49 KiB |
BIN
test_set/Yuuki, Asuna.jpg
Normal file
After Width: | Height: | Size: 405 KiB |
BIN
test_set/Zero Two.jpg
Normal file
After Width: | Height: | Size: 34 KiB |
BIN
test_set/Zoldyck, Killua.jpg
Normal file
After Width: | Height: | Size: 39 KiB |
BIN
test_set/holo.jpg
Normal file
After Width: | Height: | Size: 115 KiB |