Skip to content

Commit

Permalink
Merge pull request #15 from eroniki/fix_camera_name_in_pose_detection
Browse files Browse the repository at this point in the history
Fix camera name in pose detection
  • Loading branch information
eroniki committed Jun 17, 2019
2 parents d504194 + 064f688 commit de6d02e
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 5 deletions.
15 changes: 11 additions & 4 deletions app.py
Original file line number Diff line number Diff line change
Expand Up @@ -529,21 +529,27 @@ def pose_cam(self, exp_id, camera_id):
room_id = 0

devices = self.rooms[room_id]["devices"]
devices.sort()
camera_name = os.path.basename(devices[int(camera_id)])

fname = os.path.join(os.path.dirname(os.path.realpath(__file__)),
"data", exp_id, "raw", str(camera_name), "")
fname_result_joint = os.path.join(os.path.dirname(os.path.realpath(__file__)),
"data", exp_id, "output", "pose", "pose",
str(camera_name))

self.um.create_folder(fname_result_joint)
try:
self.um.create_folder(fname_result_joint)
except:
pass

fname_result_img = os.path.join(os.path.dirname(os.path.realpath(__file__)),
"data", exp_id, "output", "pose", "img",
str(camera_name))

self.um.create_folder(fname_result_img)
try:
self.um.create_folder(fname_result_img)
except:
pass

img_files = list()
if os.path.exists(fname):
Expand Down Expand Up @@ -578,7 +584,8 @@ def pose_cam(self, exp_id, camera_id):
self.um.dump_json(fname=fname_json,
data=joints.tolist(),
pretty=True)
exp.update_metadata(change_pd=True, pd={camera_name: idx})
camera_name_full = "/dev/v4l/by-id/" + camera_name
exp.update_metadata(change_pd=True, pd={camera_name_full: idx})

return "{n} number of images were processed!".format(n=n-1)

Expand Down
2 changes: 2 additions & 0 deletions experiment.py
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,8 @@ def create_metadata(self, ts, camera_names, room):
number_of_images = dict()
pose_detection = dict()

camera_names.sort()

for camera in camera_names:
number_of_images[camera] = 0
pose_detection[camera] = 0
Expand Down
3 changes: 2 additions & 1 deletion utils/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
import shutil
import subprocess
import zipfile
from collections import OrderedDict


class misc(object):
Expand Down Expand Up @@ -87,7 +88,7 @@ def read_json(fname):
data = None
try:
with open(fname) as file_handler:
data = json.load(file_handler)
data = json.load(file_handler, object_pairs_hook=OrderedDict)
except Exception as e:
return None
return data
Expand Down

0 comments on commit de6d02e

Please sign in to comment.