Skip to content

Commit 8493c95

Browse files
committed
change algorithm for mis
1 parent 0a974e5 commit 8493c95

File tree

3 files changed

+9
-4
lines changed

3 files changed

+9
-4
lines changed

CL_algorithm.py

+3-2
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,7 @@ def makePrediction_mis_single(self, subImage, Dict, label):
128128
def __getFeature(self, img):
129129
nR = 6;
130130
nC = 4;
131-
(r, c) = img.shape()
131+
(r, c) = img.shape
132132
deltaR = r/nR
133133
deltaC = c/nC
134134
hist = np.zeros((nR, nC))
@@ -137,7 +137,8 @@ def __getFeature(self, img):
137137
block = img[i*deltaR:(i+1)*deltaR, j*deltaC:(j+1)*deltaC]
138138
hist[i,j] = block.sum()
139139
feat = hist.reshape(nR*nC)
140-
feat = float(feat)/feat.sum()
140+
feat = feat/(float(feat.sum())+1)
141+
return feat
141142

142143

143144
def get_narrowest(self, im_array):

CL_algorithm.pyc

534 Bytes
Binary file not shown.

test.py

+6-2
Original file line numberDiff line numberDiff line change
@@ -112,8 +112,12 @@
112112
# test = [im,im,im,im]
113113
img_test_mis = Image.open('test_mis.jpg')
114114
mis = MIS()
115-
test = mis.split_codes(img_test_mis)
116-
print mis.makePrediction_mis(test)
115+
116+
a = np.zeros((30,20))
117+
test = [a,a,a,a]
118+
119+
# test = mis.split_codes(img_test_mis)
120+
print mis.makePrediction_mis_test(test)
117121

118122
# getTemplate_mis()
119123

0 commit comments

Comments
 (0)