MCPcopy Create free account
hub / github.com/WenDesi/lihang_book_algorithm / loadLabelSet

Function loadLabelSet

extract_features.py:37–58  ·  view source on GitHub ↗
(which=0)

Source from the content-addressed store, hash-verified

35 return imgs
36
37def loadLabelSet(which=0):
38 print "load label set"
39 binfile=None
40 if which==0:
41 binfile = open("data/train-labels.idx1-ubyte", 'rb')
42 else:
43 binfile= open("data/t10k-labels.idx1-ubyte", 'rb')
44 buffers = binfile.read()
45
46 head = struct.unpack_from('>II' , buffers ,0)
47 print "head,",head
48 imgNum=head[1]
49
50 offset = struct.calcsize('>II')
51 numString='>'+str(imgNum)+"B"
52 labels= struct.unpack_from(numString , buffers , offset)
53 binfile.close()
54 labels=np.reshape(labels,[imgNum,1])
55
56 #print labels
57 print 'load label finished'
58 return labels
59
60def get_features(imgs):
61 features = []

Callers 1

get_hog_featuresFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected