forked from gilbeckers/MultiPersonMatching
-
Notifications
You must be signed in to change notification settings - Fork 0
/
main_multi_person.py
51 lines (41 loc) · 2.1 KB
/
main_multi_person.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
38
39
40
41
42
43
44
45
46
47
48
49
import pose_match
import parse_openpose_json
import numpy as np
import logging
import prepocessing
logging.basicConfig(level=logging.INFO)
logger = logging.getLogger("pose_match")
json_data_path = 'json_data/'
images_data_path = 'img/'
'''
-------------------- MULTI PERSON -------------------------------------
'''
model = "abbey4"
input = "abbey8"
model_json = json_data_path + model + '_keypoints.json'
input_json = json_data_path + input + '_keypoints.json'
model_image = images_data_path + model + '.jpg'
input_image = images_data_path + input + '.jpg'
model_features = parse_openpose_json.parse_JSON_multi_person(model_json)
input_features = parse_openpose_json.parse_JSON_multi_person(input_json)
#model1 = model_features[0]
#models_array = [np.array(model1)]
#model2 = model_features[1]
#models_array = [np.array(model1), np.array(model2)]
models_array = model_features
#-------------------Simple case; poses are not checked on relation in space-------------------
#pose_match.multi_person(models_array, input_features, model_image, input_image)
#--------------------Second case; poses ARE checked on relation in space WITH NORMALISATION------------
logger.info("$$$$$ Multi pose with normalisation $$$$$$")
pose_match.multi_person2(models_array, input_features, model_image, input_image) # with normalisation
#--------------------Second case; poses ARE checked on relation in space ZONDER NORMALISATION---------
# -> Plotjesssss
# DISCLAIMER: It normal that the plot is fucked up in case of undetected body parts in the input
# -> this is because no normalisation is done here (because of the plots)
# and thus these sneaky (0,0) points are not handled.
# TODO: maybe not include the (0,0) handler only the normalising part??
# TODO: !!!!!! problem when input pose includes undetected body feature!!!
model_features = parse_openpose_json.parse_JSON_multi_person(model_json)
input_features = parse_openpose_json.parse_JSON_multi_person(input_json)
logger.info("$$$$$ Multi pose without norm (plotting) $$$$$$")
pose_match.multi_person2(model_features, input_features, model_image, input_image,False) # without normalisation