Initial Commit
This commit is contained in:
@@ -62,23 +62,19 @@ def map_blazepose_keypoint(column):
|
||||
|
||||
|
||||
def map_blazepose_df(df):
|
||||
to_drop = []
|
||||
renamings = {}
|
||||
for column in df.columns:
|
||||
mapped_column = map_blazepose_keypoint(column)
|
||||
if mapped_column:
|
||||
renamings[column] = mapped_column
|
||||
else:
|
||||
to_drop.append(column)
|
||||
df = df.rename(columns=renamings)
|
||||
|
||||
for index, row in df.iterrows():
|
||||
|
||||
sequence_size = len(row["leftEar_Y"])
|
||||
lsx = row["leftShoulder_X"]
|
||||
rsx = row["rightShoulder_X"]
|
||||
lsy = row["leftShoulder_Y"]
|
||||
rsy = row["rightShoulder_Y"]
|
||||
# convert all to list
|
||||
lsx = lsx[1:-1].split(",")
|
||||
rsx = rsx[1:-1].split(",")
|
||||
lsy = lsy[1:-1].split(",")
|
||||
rsy = rsy[1:-1].split(",")
|
||||
sequence_size = len(lsx)
|
||||
|
||||
neck_x = []
|
||||
neck_y = []
|
||||
# Treat each element of the sequence (analyzed frame) individually
|
||||
@@ -88,5 +84,4 @@ def map_blazepose_df(df):
|
||||
df.loc[index, "neck_X"] = str(neck_x)
|
||||
df.loc[index, "neck_Y"] = str(neck_y)
|
||||
|
||||
df.drop(columns=to_drop, inplace=True)
|
||||
return df
|
||||
|
||||
Reference in New Issue
Block a user