Showing
4 changed files
with
6 additions
and
14 deletions
... | @@ -218,8 +218,6 @@ def inference_pb(file_path, threshold): | ... | @@ -218,8 +218,6 @@ def inference_pb(file_path, threshold): |
218 | predictForSegment[j*2] = normalize_tag(str(voca_dict[str(predictForSegment[j*2])])) | 218 | predictForSegment[j*2] = normalize_tag(str(voca_dict[str(predictForSegment[j*2])])) |
219 | #클래스 확률 클래스 확률... 일케 저장되어 있음 | 219 | #클래스 확률 클래스 확률... 일케 저장되어 있음 |
220 | inputVideoTagResults.append(predictForSegment) | 220 | inputVideoTagResults.append(predictForSegment) |
221 | - | ||
222 | - #이 다음문단은 이전거 원래 이게 recomment videos의 첫 파라미터임 | ||
223 | 221 | ||
224 | tag_result = [] | 222 | tag_result = [] |
225 | for itemIndex in range(TAG_TOP_K): | 223 | for itemIndex in range(TAG_TOP_K): | ... | ... |
... | @@ -85,7 +85,6 @@ def recommend_videos(tags, segments, tag_model_path, video_model_path, video_id_ | ... | @@ -85,7 +85,6 @@ def recommend_videos(tags, segments, tag_model_path, video_model_path, video_id_ |
85 | maxSimilarSegment = len(segments) - int(len(kernel)/2) - 1 | 85 | maxSimilarSegment = len(segments) - int(len(kernel)/2) - 1 |
86 | #세그먼트 인덱스 증가 | 86 | #세그먼트 인덱스 증가 |
87 | currentIndex = currentIndex + 1 | 87 | currentIndex = currentIndex + 1 |
88 | - #######################################print('maxSimilarSegment',maxSimilarSegment,'len',len(segments)) | ||
89 | #커널 생성 | 88 | #커널 생성 |
90 | for k in range (0,len(kernel)): | 89 | for k in range (0,len(kernel)): |
91 | segment = segments[maxSimilarSegment - math.floor(len(kernel)/2) + k] | 90 | segment = segments[maxSimilarSegment - math.floor(len(kernel)/2) + k] |
... | @@ -124,10 +123,8 @@ def recommend_videos(tags, segments, tag_model_path, video_model_path, video_id_ | ... | @@ -124,10 +123,8 @@ def recommend_videos(tags, segments, tag_model_path, video_model_path, video_id_ |
124 | 123 | ||
125 | if video_id[0:4] != prevVideoId[0:4]: | 124 | if video_id[0:4] != prevVideoId[0:4]: |
126 | 125 | ||
127 | - #여기서 모다진걸로 컨볼루션 연산 | 126 | + #여기서 모여진 segment로 컨볼루션 연산 |
128 | - #convmaxima, convidx = convolution(videoVectorList,kernel,prevVideoId) | ||
129 | maxima, idx = differenceMax(segmentTagList,tagKernel,tag_vectors,videoTagList) | 127 | maxima, idx = differenceMax(segmentTagList,tagKernel,tag_vectors,videoTagList) |
130 | - #maxima = maxima + convmaxima | ||
131 | 128 | ||
132 | localMinima = 100 | 129 | localMinima = 100 |
133 | localMinimaIndex = -1 | 130 | localMinimaIndex = -1 |
... | @@ -135,9 +132,7 @@ def recommend_videos(tags, segments, tag_model_path, video_model_path, video_id_ | ... | @@ -135,9 +132,7 @@ def recommend_videos(tags, segments, tag_model_path, video_model_path, video_id_ |
135 | if float(minimunVideoIds[seg][1]) < localMinima: | 132 | if float(minimunVideoIds[seg][1]) < localMinima: |
136 | localMinima = float(minimunVideoIds[seg][1]) | 133 | localMinima = float(minimunVideoIds[seg][1]) |
137 | localMinimaIndex = seg | 134 | localMinimaIndex = seg |
138 | - #print(maxima) | ||
139 | if localMinima < maxima: | 135 | if localMinima < maxima: |
140 | - #print(prevVideoId[0:4] + "_" + str(idx),localMinimaIndex,maxima) | ||
141 | minimunVideoIds[localMinimaIndex] = [prevVideoId[0:4] + "_" + str(idx),maxima] | 136 | minimunVideoIds[localMinimaIndex] = [prevVideoId[0:4] + "_" + str(idx),maxima] |
142 | 137 | ||
143 | 138 | ||
... | @@ -207,13 +202,13 @@ def differenceMax(arrs, _kernel, w2v, videoTaglist): | ... | @@ -207,13 +202,13 @@ def differenceMax(arrs, _kernel, w2v, videoTaglist): |
207 | arrs.insert(0,arrs[0]) | 202 | arrs.insert(0,arrs[0]) |
208 | arrs.append(arrs[len(arrs)-1]) | 203 | arrs.append(arrs[len(arrs)-1]) |
209 | 204 | ||
210 | - prevIndex = 0 | 205 | + maximaIndex = 0 |
211 | prevMax = -100 | 206 | prevMax = -100 |
212 | for j in range(midpos,len(arrs) - midpos): | 207 | for j in range(midpos,len(arrs) - midpos): |
213 | convResult = 0 | 208 | convResult = 0 |
214 | processed_vocabNum = 1 | 209 | processed_vocabNum = 1 |
215 | for i in range(0, s): | 210 | for i in range(0, s): |
216 | - if(_kernel[i][0] not in arrs[j - midpos + i][0]):# and ((videoTaglist[0] not in arrs[j - midpos + i][0:2])) and ((videoTaglist[1] not in arrs[j - midpos + i][0:5])): | 211 | + if(_kernel[i][0] not in arrs[j - midpos + i][0]): |
217 | continue | 212 | continue |
218 | for ind in range(0,5): | 213 | for ind in range(0,5): |
219 | if(arrs[j - midpos + i][ind][0] in w2v.vocab) and (_kernel[i][ind] in w2v.vocab): | 214 | if(arrs[j - midpos + i][ind][0] in w2v.vocab) and (_kernel[i][ind] in w2v.vocab): |
... | @@ -225,11 +220,10 @@ def differenceMax(arrs, _kernel, w2v, videoTaglist): | ... | @@ -225,11 +220,10 @@ def differenceMax(arrs, _kernel, w2v, videoTaglist): |
225 | 220 | ||
226 | if prevMax < convResult: | 221 | if prevMax < convResult: |
227 | prevMax = convResult | 222 | prevMax = convResult |
228 | - prevIndex = j - midpos | 223 | + maximaIndex = j - midpos |
229 | result.append(convResult) | 224 | result.append(convResult) |
230 | - #maxVal = max(result) | 225 | + |
231 | - #index = result.index(maxVal) | 226 | + return prevMax,maximaIndex |
232 | - return prevMax,prevIndex | ||
233 | 227 | ||
234 | def normalize(arrs): | 228 | def normalize(arrs): |
235 | maximum = max(arrs) | 229 | maximum = max(arrs) | ... | ... |
발표영상.mp4
deleted
100644 → 0
This file is too large to display.
No preview for this file type
-
Please register or login to post a comment