-
Notifications
You must be signed in to change notification settings - Fork 0
/
load_data.py
29 lines (28 loc) · 937 Bytes
/
load_data.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
#coding:utf-8
import h5py
import scipy.io as sio
import numpy as np
def loading_data(path):
image_path = path + "NImage.mat"
label_path = path + "Label.mat"
tag_path = path + "Tags.mat"
images = sio.loadmat(image_path)['img']
images = images.transpose(0, 3, 1, 2)
tags = sio.loadmat(tag_path)['tags']
labels = sio.loadmat(label_path)["label"]
return images, tags, labels
def loading_cloth_data(path):
image_path = path + "image.mat"
label_path = path + "label.mat"
tag_path = path + "tag.mat"
images=sio.loadmat(image_path)['Image']
images=images.transpose(0,3,1,2)
tags = sio.loadmat(tag_path)['Tag']
labels = sio.loadmat(label_path)["Label"]
return images, tags, labels
if __name__=='__main__':
path = '/home/share/sunchangchang/data/data1/'
images, tags, labels = loading_cloth_data(path)
print (images.shape)
print (tags.shape)
print (labels.shape)