Toggle navigation
Toggle navigation
This project
Loading...
Sign in
2020-2-capstone-design2
/
2015104192
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Snippets
Network
Create a new issue
Builds
Commits
Issue Boards
Authored by
윤영빈
2020-12-09 01:05:02 +0900
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
f2dfcea2caf33fe140e7a6116395a3c8b97b4412
f2dfcea2
1 parent
0f0ea353
tmep
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
8 additions
and
18 deletions
README.md
web/backend/yt8m/esot3ria/video_recommender.py
README.md
View file @
f2dfcea
# 내용 기반 유튜브 영상 추천 시스템 개선안
#
Video vector list를 이용한
내용 기반 유튜브 영상 추천 시스템 개선안
## Research field
*
Video Understanding
...
...
web/backend/yt8m/esot3ria/video_recommender.py
View file @
f2dfcea
...
...
@@ -5,6 +5,7 @@ from numpy.linalg import norm
import
pandas
as
pd
import
math
import
activation
as
ac
import
time
def
recommend_videos
(
tags
,
segments
,
tag_model_path
,
video_model_path
,
video_id_model
,
top_k
,
isPerSegment
=
True
):
# 이 함수에서 모든걸 다 함
...
...
@@ -108,18 +109,15 @@ def recommend_videos(tags, segments, tag_model_path, video_model_path, video_id_
error_tags
.
append
(
tag
)
kernel
[
k
]
=
segment_vector
for
t
in
tagKernel
:
print
(
t
)
#여기에서 유사한 벡터들을 뽑아냄
#현재는 비디오id로 영상을 얻을 수 없으므로 반환값으로 비디오 아이디와 태그들, 확률 사용
video_tags
=
pd
.
read_csv
(
'/mnt/e/khuhub/2015104192/web/backend/yt8m/esot3ria/segment_tags.csv'
,
encoding
=
'utf8'
,
error_bad_lines
=
False
)
video_tags_per_id
=
pd
.
read_csv
(
'/mnt/e/khuhub/2015104192/web/backend/yt8m/esot3ria/videoIds.csv'
,
encoding
=
'utf8'
,
error_bad_lines
=
False
)
videoId_index
=
0
videoVectorList
=
[]
segmentTagList
=
[]
prevVideoId
=
""
minimunVideoIds
=
[[
""
,
-
1.0
]
for
i
in
range
(
0
,
top_k
)]
prev_sev
=
time
.
time
()
for
i
,
row
in
video_tags
.
iterrows
():
video_id
=
row
[
0
]
if
video_id
==
"vid_id"
:
...
...
@@ -129,16 +127,6 @@ def recommend_videos(tags, segments, tag_model_path, video_model_path, video_id_
if
video_id
[
0
:
4
]
!=
prevVideoId
[
0
:
4
]:
currentComparingVideoTags
=
video_tags_per_id
.
loc
[
videoId_index
]
videoId_index
+=
1
print
(
videoTagList
)
print
(
currentComparingVideoTags
)
if
(
currentComparingVideoTags
[
'segment1'
]
.
split
(
':'
)[
0
]
not
in
videoTagList
and
currentComparingVideoTags
[
'segment2'
]
.
split
(
':'
)[
0
]
not
in
videoTagList
and
currentComparingVideoTags
[
'segment3'
]
.
split
(
':'
)[
0
]
not
in
videoTagList
and
currentComparingVideoTags
[
'segment4'
]
.
split
(
':'
)[
0
]
not
in
videoTagList
and
currentComparingVideoTags
[
'segment5'
]
.
split
(
':'
)[
0
]
not
in
videoTagList
):
continue
#여기서 모다진걸로 컨볼루션 연산
#convmaxima, convidx = convolution(videoVectorList,kernel,prevVideoId)
maxima
,
idx
=
differenceMax
(
segmentTagList
,
tagKernel
,
tag_vectors
,
videoTagList
)
...
...
@@ -167,11 +155,13 @@ def recommend_videos(tags, segments, tag_model_path, video_model_path, video_id_
for
i
in
range
(
1
,
top_k
+
1
):
tagList
.
append
([
row
[
i
]
.
split
(
":"
)[
0
],
row
[
i
]
.
split
(
":"
)[
1
]])
segmentTagList
.
append
(
tagList
)
print
(
time
.
time
()
-
prev_sev
)
for
i
in
range
(
0
,
top_k
):
similar_ids
.
append
(
minimunVideoIds
[
i
][
0
])
else
:
similar_ids
=
[
x
[
0
]
for
x
in
video_ids
.
similar_by_vector
(
video_vector
,
top_k
)]
print
(
similar_ids
)
return
similar_ids
...
...
@@ -379,7 +369,7 @@ VIDEO_ID_MODEL_PATH = "/mnt/e/khuhub/2015104192/web/backend/yt8m/esot3ria/videoI
TEST_TAGS_PATH
=
"/mnt/e/khuhub/2015104192/web/backend/yt8m/esot3ria/test_segement_tags.csv"
'''
test(TAG_VECTOR_MODEL_PATH,
VIDEO_VECTOR_MODEL_PATH,
VIDEO_ID_MODEL_PATH,
...
...
@@ -387,4 +377,4 @@ test(TAG_VECTOR_MODEL_PATH,
VIDEO_TAGS_PATH,
TEST_TAGS_PATH,
5)
\ No newline at end of file
'''
\ No newline at end of file
...
...
Please
register
or
login
to post a comment