create test set #2
@ -4,11 +4,12 @@ from skimage.io import imread
|
|||||||
import cv2 as cv
|
import cv2 as cv
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
def load_data(input_dir, newSize=(64,64)):
|
def load_data(input_dir, newSize=(64,64)):
|
||||||
image_path = Path(input_dir)
|
image_path = Path(input_dir)
|
||||||
file_names = os.listdir(image_path)
|
file_names = os.listdir(image_path)
|
||||||
categories_name = []
|
categories_name = []
|
||||||
s444409
commented
`categories_count = []`
|
|||||||
categories_count=[]
|
categories_count = []
|
||||||
count = 0
|
count = 0
|
||||||
n = file_names[0]
|
n = file_names[0]
|
||||||
for name in file_names:
|
for name in file_names:
|
||||||
@ -22,7 +23,7 @@ def load_data(input_dir, newSize=(64,64)):
|
|||||||
categories_name.append(name)
|
categories_name.append(name)
|
||||||
categories_count.append(count)
|
categories_count.append(count)
|
||||||
test_img = []
|
test_img = []
|
||||||
s444409
commented
`labels = []`
|
|||||||
labels=[]
|
labels = []
|
||||||
|
|
||||||
for n in file_names:
|
for n in file_names:
|
||||||
p = image_path / n
|
p = image_path / n
|
||||||
@ -32,15 +33,9 @@ def load_data(input_dir, newSize=(64,64)):
|
|||||||
test_img.append(img)
|
test_img.append(img)
|
||||||
labels.append(n)
|
labels.append(n)
|
||||||
|
|
||||||
s444409
commented
Hm, nie lepiej byłoby żeby ta struktura wyglądała w ten sposób?
Hm, nie lepiej byłoby żeby ta struktura wyglądała w ten sposób?
```json
[
{
"name": "plik.jpg"
"values": <np.ndarray>
},
...
]
```
|
|||||||
X={}
|
X = {}
|
||||||
X["values"] = np.array(test_img)
|
X["values"] = np.array(test_img)
|
||||||
X["categories_name"] = categories_name
|
X["name"] = categories_name
|
||||||
X["categories_count"] = categories_count
|
X["names_count"] = categories_count
|
||||||
X["labels"]=labels
|
X["labels"] = labels
|
||||||
return X
|
return X
|
||||||
|
|
||||||
data = load_data('test_set')
|
|
||||||
print(data['categories_name'])
|
|
||||||
print(data['categories_count'])
|
|
||||||
print(data['labels'])
|
|
||||||
print(list(data["values"]))
|
|
Loading…
Reference in New Issue
Block a user
Jedna nowa linia więcej nad tą funkcją
PEP 8: E302 expected 2 blank lines, found 1