-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathtest.py
37 lines (29 loc) · 1.23 KB
/
test.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
from platform_image_captioning_inference_service_sub import video_tracking, IM, multi_image_caption
from platform_image_captioning_preprocess import init_svc
import pandas as pd
pd.set_option('display.max_rows', None)
pd.set_option('display.max_columns', None)
result_list = video_tracking(input_type='A', table=None, input_keyword='')
result = pd.DataFrame(result_list)
table = result.drop_duplicates(subset='object_id', keep='first')
table = table.reset_index(drop=True)
print("*" * 70)
print(table)
print("*" * 70)
# 비디오에서 사람 객체 이미지 크롭 및 SR 진행
# params: 사용할 모델(blip), preprocessor 및 전처리된 images 반환
im = IM()
params = init_svc(im, table) # {'model_blip': model_blip, 'processor_blip': processor_blip, 'cropped_images':images}
# 캡션 생성 및 table에 객체 id별 캡션 넣어주기
captions = multi_image_caption(params)
table['caption'] = captions
print("*" * 70)
print(table)
print("*" * 70)
input_keyword = [""] # 키워드 0개
# input_keyword = ["woman"] # 키워드 1개
# input_keyword=["man", "black"] # 키워드 2개
result_list = video_tracking(input_type='B', table=table, input_keyword=input_keyword)
print("keyword: ", input_keyword)
print(result_list)
print("*" * 70)