Showing
11 changed files
with
43 additions
and
31 deletions
... | @@ -18,7 +18,7 @@ import shlex | ... | @@ -18,7 +18,7 @@ import shlex |
18 | import json | 18 | import json |
19 | # Create your views here. | 19 | # Create your views here. |
20 | import sys | 20 | import sys |
21 | -sys.path.insert(0, "/home/jun/documents/univ/PKH_Project1/web/backend/yt8m/esot3ria") | 21 | +sys.path.insert(0, "/khuhub/2015104192/web/backend/yt8m/esot3ria") |
22 | import inference_pb | 22 | import inference_pb |
23 | 23 | ||
24 | def with_ffprobe(filename): | 24 | def with_ffprobe(filename): |
... | @@ -76,14 +76,17 @@ class VideoFileUploadView(APIView): | ... | @@ -76,14 +76,17 @@ class VideoFileUploadView(APIView): |
76 | if file_serializer.is_valid(): | 76 | if file_serializer.is_valid(): |
77 | file_serializer.save() | 77 | file_serializer.save() |
78 | # 동영상 길이 출력 | 78 | # 동영상 길이 출력 |
79 | - runTime = with_ffprobe('/'+file_serializer.data['file_save_name']) | 79 | + fileFullName = file_serializer.data['file_save_name'] |
80 | - print(runTime) | 80 | + fileProcessedName = fileFullName.replace("%3A",":") |
81 | + runTime = with_ffprobe(fileProcessedName) | ||
82 | + print('RUNTIME ::::==== ' + str(runTime)) | ||
81 | print(threshold) | 83 | print(threshold) |
82 | - process = subprocess.Popen(['./runMediaPipe.sh %s %s' %(file_serializer.data['file_save_name'],runTime,)], shell = True) | 84 | + print('CURR DIR = ' + os.getcwd()) |
85 | + process = subprocess.Popen(['./runMediaPipe.sh %s %s' %(fileProcessedName,runTime,)], shell = True) | ||
83 | process.wait() | 86 | process.wait() |
84 | 87 | ||
85 | 88 | ||
86 | - result = inference_pb.inference_pb('/tmp/mediapipe/features.pb', threshold) | 89 | + result = inference_pb.inference_pb('E:/khuhub/2015104192/web/backend/yt8m/featuremaps/features(baby_samoyed).pb', threshold) |
87 | 90 | ||
88 | return Response(result, status=status.HTTP_201_CREATED) | 91 | return Response(result, status=status.HTTP_201_CREATED) |
89 | else: | 92 | else: | ... | ... |
web/backend/get-pip.py
0 → 100644
This diff could not be displayed because it is too large.
1 | Django==3.0.5 | 1 | Django==3.0.5 |
2 | django-cors-headers==3.2.1 | 2 | django-cors-headers==3.2.1 |
3 | djangorestframework==3.11.0 | 3 | djangorestframework==3.11.0 |
4 | -tensorflow==1.15 | 4 | +tensorflow==1.14 |
5 | pandas==1.0.4 | 5 | pandas==1.0.4 |
6 | gensim==3.8.3 | 6 | gensim==3.8.3 |
... | \ No newline at end of file | ... | \ No newline at end of file | ... | ... |
1 | #!/bin/bash | 1 | #!/bin/bash |
2 | -cd ../../../mediapipe | 2 | +cd ../../../../mediapipe |
3 | . venv/bin/activate | 3 | . venv/bin/activate |
4 | +echo "STEP1" | ||
5 | +bazel version && \ | ||
6 | +alias bazel='bazel' | ||
4 | 7 | ||
5 | -/usr/local/bazel/2.0.0/lib/bazel/bin/bazel version && \ | 8 | +echo "STEP2" |
6 | -alias bazel='/usr/local/bazel/2.0.0/lib/bazel/bin/bazel' | ||
7 | 9 | ||
8 | python -m mediapipe.examples.desktop.youtube8m.generate_input_sequence_example \ | 10 | python -m mediapipe.examples.desktop.youtube8m.generate_input_sequence_example \ |
9 | --path_to_input_video=/$1 \ | 11 | --path_to_input_video=/$1 \ |
10 | --clip_end_time_sec=$2 | 12 | --clip_end_time_sec=$2 |
11 | - | 13 | +echo "STEP3" |
12 | -GLOG_logtostderr=1 bazel-bin/mediapipe/examples/desktop/youtube8m/extract_yt8m_features \ | 14 | +GLOG_logtostderr=1 /mediapipe/examples/desktop/youtube8m/extract_yt8m_features \ |
13 | --calculator_graph_config_file=mediapipe/graphs/youtube8m/feature_extraction.pbtxt \ | 15 | --calculator_graph_config_file=mediapipe/graphs/youtube8m/feature_extraction.pbtxt \ |
14 | --input_side_packets=input_sequence_example=/tmp/mediapipe/metadata.pb \ | 16 | --input_side_packets=input_sequence_example=/tmp/mediapipe/metadata.pb \ |
15 | - --output_side_packets=output_sequence_example=/tmp/mediapipe/features.pb | ||
... | \ No newline at end of file | ... | \ No newline at end of file |
17 | + --output_side_packets=output_sequence_example=/tmp/mediapipe/features.pb | ||
18 | +echo "COMPLETED" | ||
19 | + | ||
20 | +sleep 5 | ||
... | \ No newline at end of file | ... | \ No newline at end of file | ... | ... |
1 | +#-*- coding: utf-8 -*- | ||
1 | import numpy as np | 2 | import numpy as np |
2 | import tensorflow as tf | 3 | import tensorflow as tf |
3 | from tensorflow import logging | 4 | from tensorflow import logging |
... | @@ -8,12 +9,12 @@ import video_recommender as recommender | ... | @@ -8,12 +9,12 @@ import video_recommender as recommender |
8 | import video_util as videoutil | 9 | import video_util as videoutil |
9 | 10 | ||
10 | # Define file paths. | 11 | # Define file paths. |
11 | -MODEL_PATH = "/home/jun/documents/univ/PKH_Project1/web/backend/yt8m/esot3ria/model/inference_model/segment_inference_model" | 12 | +MODEL_PATH = "E:/khuhub/2015104192/web/backend/yt8m/esot3ria/model/inference_model/segment_inference_model" |
12 | -VOCAB_PATH = "/home/jun/documents/univ/PKH_Project1/web/backend/yt8m/vocabulary.csv" | 13 | +VOCAB_PATH = "E:/khuhub/2015104192/web/backend/yt8m/vocabulary.csv" |
13 | -VIDEO_TAGS_PATH = "/home/jun/documents/univ/PKH_Project1/web/backend/yt8m/esot3ria/kaggle_solution_40k.csv" | 14 | +VIDEO_TAGS_PATH = "E:/khuhub/2015104192/web/backend/yt8m/esot3ria/kaggle_solution_40k.csv" |
14 | -TAG_VECTOR_MODEL_PATH = "/home/jun/documents/univ/PKH_Project1/web/backend/yt8m/esot3ria/tag_vectors.model" | 15 | +TAG_VECTOR_MODEL_PATH = "E:/khuhub/2015104192/web/backend/yt8m/esot3ria/tag_vectors.model" |
15 | -VIDEO_VECTOR_MODEL_PATH = "/home/jun/documents/univ/PKH_Project1/web/backend/yt8m/esot3ria/video_vectors.model" | 16 | +VIDEO_VECTOR_MODEL_PATH = "E:/khuhub/2015104192/web/backend/yt8m/esot3ria/video_vectors.model" |
16 | -SEGMENT_LABEL_PATH = "/home/jun/documents/univ/PKH_Project1/web/backend/yt8m/segment_label_ids.csv" | 17 | +SEGMENT_LABEL_PATH = "E:/khuhub/2015104192/web/backend/yt8m/segment_label_ids.csv" |
17 | 18 | ||
18 | # Define parameters. | 19 | # Define parameters. |
19 | TAG_TOP_K = 5 | 20 | TAG_TOP_K = 5 |
... | @@ -85,6 +86,7 @@ def normalize_tag(tag): | ... | @@ -85,6 +86,7 @@ def normalize_tag(tag): |
85 | 86 | ||
86 | 87 | ||
87 | def inference_pb(file_path, threshold): | 88 | def inference_pb(file_path, threshold): |
89 | + print("started step 1") | ||
88 | VIDEO_TOP_K = int(threshold) | 90 | VIDEO_TOP_K = int(threshold) |
89 | inference_result = {} | 91 | inference_result = {} |
90 | with tf.Session(config=tf.ConfigProto(allow_soft_placement=True)) as sess: | 92 | with tf.Session(config=tf.ConfigProto(allow_soft_placement=True)) as sess: |
... | @@ -168,7 +170,7 @@ def inference_pb(file_path, threshold): | ... | @@ -168,7 +170,7 @@ def inference_pb(file_path, threshold): |
168 | 170 | ||
169 | # 3. Make vocabularies. | 171 | # 3. Make vocabularies. |
170 | voca_dict = {} | 172 | voca_dict = {} |
171 | - vocabs = open(VOCAB_PATH, 'r') | 173 | + vocabs = open(VOCAB_PATH, 'r', encoding='UTF8') |
172 | while True: | 174 | while True: |
173 | line = vocabs.readline() | 175 | line = vocabs.readline() |
174 | if not line: break | 176 | if not line: break |
... | @@ -176,7 +178,7 @@ def inference_pb(file_path, threshold): | ... | @@ -176,7 +178,7 @@ def inference_pb(file_path, threshold): |
176 | if vocab_dict_item[0] != "Index": | 178 | if vocab_dict_item[0] != "Index": |
177 | voca_dict[vocab_dict_item[0]] = vocab_dict_item[3] | 179 | voca_dict[vocab_dict_item[0]] = vocab_dict_item[3] |
178 | vocabs.close() | 180 | vocabs.close() |
179 | - | 181 | + print("made vocabs") |
180 | # 4. Make combined scores. | 182 | # 4. Make combined scores. |
181 | combined_scores = {} | 183 | combined_scores = {} |
182 | for line in format_predictions(video_id_batch_val, predictions_val, TAG_TOP_K, whitelisted_cls_mask): | 184 | for line in format_predictions(video_id_batch_val, predictions_val, TAG_TOP_K, whitelisted_cls_mask): | ... | ... |
... | @@ -113,7 +113,6 @@ def make_exmp(id, audio, rgb): | ... | @@ -113,7 +113,6 @@ def make_exmp(id, audio, rgb): |
113 | 113 | ||
114 | def convert_pb(filename): | 114 | def convert_pb(filename): |
115 | sequence_example = open(filename, 'rb').read() | 115 | sequence_example = open(filename, 'rb').read() |
116 | - | ||
117 | audio, rgb = parse_exmp(sequence_example) | 116 | audio, rgb = parse_exmp(sequence_example) |
118 | tmp_example = make_exmp('video', audio, rgb) | 117 | tmp_example = make_exmp('video', audio, rgb) |
119 | 118 | ... | ... |
This file is too large to display.
... | @@ -8,6 +8,7 @@ FLAGS = flags.FLAGS | ... | @@ -8,6 +8,7 @@ FLAGS = flags.FLAGS |
8 | 8 | ||
9 | 9 | ||
10 | def main(unused_argv): | 10 | def main(unused_argv): |
11 | + print("start mediapipe") | ||
11 | # Get the input tensor names to be replaced. | 12 | # Get the input tensor names to be replaced. |
12 | tf.reset_default_graph() | 13 | tf.reset_default_graph() |
13 | meta_graph_location = FLAGS.checkpoint_file + ".meta" | 14 | meta_graph_location = FLAGS.checkpoint_file + ".meta" | ... | ... |
... | @@ -17,5 +17,6 @@ module.exports = { | ... | @@ -17,5 +17,6 @@ module.exports = { |
17 | 'no-debugger': process.env.NODE_ENV === 'production' ? 'warn' : 'off', | 17 | 'no-debugger': process.env.NODE_ENV === 'production' ? 'warn' : 'off', |
18 | 'linebreak-style': 0, | 18 | 'linebreak-style': 0, |
19 | 'max-len': ['error', { code: 200 }], | 19 | 'max-len': ['error', { code: 200 }], |
20 | + 'import/no-extraneous-dependencies': ["error", {"devDependencies": true}], | ||
20 | }, | 21 | }, |
21 | }; | 22 | }; | ... | ... |
This diff could not be displayed because it is too large.
... | @@ -11,12 +11,12 @@ | ... | @@ -11,12 +11,12 @@ |
11 | "@mdi/font": "^3.6.95", | 11 | "@mdi/font": "^3.6.95", |
12 | "axios": "^0.19.2", | 12 | "axios": "^0.19.2", |
13 | "core-js": "^3.6.5", | 13 | "core-js": "^3.6.5", |
14 | - "moment": "^2.24.0", | 14 | + "moment": "^2.29.1", |
15 | "roboto-fontface": "*", | 15 | "roboto-fontface": "*", |
16 | - "vue": "^2.6.12", | 16 | + "vue-router": "^3.4.7", |
17 | - "vue-router": "^3.1.6", | 17 | + "vuetify": "^2.3.15", |
18 | - "vuetify": "^2.2.11", | 18 | + "vuex": "^3.5.1", |
19 | - "vuex": "^3.1.3" | 19 | + "yarn": "^1.22.10" |
20 | }, | 20 | }, |
21 | "devDependencies": { | 21 | "devDependencies": { |
22 | "@vue/cli-plugin-babel": "~4.3.0", | 22 | "@vue/cli-plugin-babel": "~4.3.0", |
... | @@ -24,16 +24,17 @@ | ... | @@ -24,16 +24,17 @@ |
24 | "@vue/cli-plugin-router": "~4.3.0", | 24 | "@vue/cli-plugin-router": "~4.3.0", |
25 | "@vue/cli-plugin-vuex": "~4.3.0", | 25 | "@vue/cli-plugin-vuex": "~4.3.0", |
26 | "@vue/cli-service": "~4.3.0", | 26 | "@vue/cli-service": "~4.3.0", |
27 | - "@vue/eslint-config-airbnb": "^5.0.2", | 27 | + "@vue/eslint-config-airbnb": "^5.1.0", |
28 | "babel-eslint": "^10.1.0", | 28 | "babel-eslint": "^10.1.0", |
29 | "eslint": "^6.7.2", | 29 | "eslint": "^6.7.2", |
30 | - "eslint-plugin-import": "^2.20.2", | 30 | + "eslint-plugin-import": "^2.22.1", |
31 | "eslint-plugin-vue": "^6.2.2", | 31 | "eslint-plugin-vue": "^6.2.2", |
32 | "node-sass": "^4.12.0", | 32 | "node-sass": "^4.12.0", |
33 | - "sass": "^1.19.0", | 33 | + "sass": "^1.27.0", |
34 | "sass-loader": "^8.0.2", | 34 | "sass-loader": "^8.0.2", |
35 | - "vue-cli-plugin-vuetify": "~2.0.5", | 35 | + "vue": "^2.6.12", |
36 | + "vue-cli-plugin-vuetify": "^2.0.7", | ||
36 | "vue-template-compiler": "^2.6.11", | 37 | "vue-template-compiler": "^2.6.11", |
37 | - "vuetify-loader": "^1.3.0" | 38 | + "vuetify-loader": "^1.6.0" |
38 | } | 39 | } |
39 | } | 40 | } | ... | ... |
-
Please register or login to post a comment