윤영빈

edit ppt

......@@ -218,8 +218,6 @@ def inference_pb(file_path, threshold):
predictForSegment[j*2] = normalize_tag(str(voca_dict[str(predictForSegment[j*2])]))
#클래스 확률 클래스 확률... 일케 저장되어 있음
inputVideoTagResults.append(predictForSegment)
#이 다음문단은 이전거 원래 이게 recomment videos의 첫 파라미터임
tag_result = []
for itemIndex in range(TAG_TOP_K):
......
......@@ -85,7 +85,6 @@ def recommend_videos(tags, segments, tag_model_path, video_model_path, video_id_
maxSimilarSegment = len(segments) - int(len(kernel)/2) - 1
#세그먼트 인덱스 증가
currentIndex = currentIndex + 1
#######################################print('maxSimilarSegment',maxSimilarSegment,'len',len(segments))
#커널 생성
for k in range (0,len(kernel)):
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_
if video_id[0:4] != prevVideoId[0:4]:
#여기서 모다진걸로 컨볼루션 연산
#convmaxima, convidx = convolution(videoVectorList,kernel,prevVideoId)
#여기서 모여진 segment로 컨볼루션 연산
maxima, idx = differenceMax(segmentTagList,tagKernel,tag_vectors,videoTagList)
#maxima = maxima + convmaxima
localMinima = 100
localMinimaIndex = -1
......@@ -135,9 +132,7 @@ def recommend_videos(tags, segments, tag_model_path, video_model_path, video_id_
if float(minimunVideoIds[seg][1]) < localMinima:
localMinima = float(minimunVideoIds[seg][1])
localMinimaIndex = seg
#print(maxima)
if localMinima < maxima:
#print(prevVideoId[0:4] + "_" + str(idx),localMinimaIndex,maxima)
minimunVideoIds[localMinimaIndex] = [prevVideoId[0:4] + "_" + str(idx),maxima]
......@@ -207,13 +202,13 @@ def differenceMax(arrs, _kernel, w2v, videoTaglist):
arrs.insert(0,arrs[0])
arrs.append(arrs[len(arrs)-1])
prevIndex = 0
maximaIndex = 0
prevMax = -100
for j in range(midpos,len(arrs) - midpos):
convResult = 0
processed_vocabNum = 1
for i in range(0, s):
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])):
if(_kernel[i][0] not in arrs[j - midpos + i][0]):
continue
for ind in range(0,5):
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):
if prevMax < convResult:
prevMax = convResult
prevIndex = j - midpos
maximaIndex = j - midpos
result.append(convResult)
#maxVal = max(result)
#index = result.index(maxVal)
return prevMax,prevIndex
return prevMax,maximaIndex
def normalize(arrs):
maximum = max(arrs)
......
This file is too large to display.