Example #1
0
_start = time()
# for frame in range(0, 214):
end_frame = 100
for frame in range(0, end_frame):
    Im, calib, pos2d, pos3d = kth.get(
        data_root, seq1_zipname, seq1_dir, frame, player=2)
    Calib.append(calib)
    Pos3d.append(pos3d)
    Ims.append(Im)

    txt_add = str(peak_threshold)
    if 0.099 < peak_threshold < 0.101:
        txt_add = ''

    name = 'cvpr_kth_' + seq1_zipname + txt_add
    predictions = pe.predict(Im, name, frame)
    poses_per_frame.append(predictions)
_end = time()
print('elapsed', _end - _start)

tracks = tracking(Calib, poses_per_frame,
                  epi_threshold=110,
                  scale_to_mm=1000,
                  max_distance_between_tracks=200,
                  distance_threshold=200,
                  correct_limb_size=False,
                  merge_distance=200)

track = tracks[0]
from mvpose.baseline.tracking import Track
track = Track.smoothing(track, sigma=2.3, interpolation_range=5)
Example #2
0
    ax.set_ylim([1080, 0])

    for pid, points3d_weighted in Y:
        pts3d = points3d_weighted[:, 0:3].astype('float32')
        pts2d = cam.projectPoints(pts3d)
        pts2dT = pts2d.transpose()
        ax.scatter(pts2d[:, 0], pts2d[:, 1], color=colors[pid])
        for edge in body_edges:
            ax.plot(pts2dT[0, edge], pts2dT[1, edge], color=colors[pid])

plt.tight_layout()

plt.pause(2)

pe = OpenPose(tmp=tmp)
predictions = pe.predict(Im, 'cvpr_cmu', FRAME)

# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
fig = plt.figure(figsize=(16, 8))
for idx, (im, pred) in enumerate(zip(Im, predictions)):
    ax = fig.add_subplot(2, 3, idx + 1)
    ax.axis('off')
    ax.imshow(im)
    ax.set_xlim([0, 1920])
    ax.set_ylim([1080, 0])

    for human in pred:
        draw_mscoco_human2d(ax, human[:, 0:2], color='red')

plt.tight_layout()
plt.pause(2)
Example #3
0
pe = OpenPose(tmp=tmp, peak_threshold=0.05)
valid_frames = list(range(350, 470)) + list(range(650, 750))

Calib = []
poses_per_frame = []
Pos3d = {}
Imgs = {}
peak_threshold = 0.05

_start = time()
for frame in valid_frames:
    Im, Y, calib = epfl_campus.get(root, frame)
    Imgs[frame] = Im
    Calib.append(calib)
    Pos3d[frame] = Y
    predictions = pe.predict(Im, 'cvpr_campus' + str(peak_threshold),
                             frame)
    poses_per_frame.append(predictions)
_end = time()
print('elapsed', _end - _start)

from mvpose.baseline.tracking import tracking, Track
_start = time()
tracks = tracking(Calib, poses_per_frame,
                  epi_threshold=20,
                  scale_to_mm=1000,
                  max_distance_between_tracks=200,
                  actual_frames=valid_frames,
                  min_track_length=10,
                  merge_distance=80,
                  last_seen_delay=5)
_end = time()
from mvpose.algorithm.candidate_selection import project_human_to_2d
from mvpose.plot.limbs import draw_mscoco_human, draw_mscoco_human2d

# heatmaps, pafs = paf_loader.load_confidence_map_and_paf(
#     'kth' + seq1_zipname[0:-4], Im, FRAME, dir=tmp)
# _start = time()
# Debug, detections = pose.estimate(Calib, heatmaps, pafs,
#                                   settings=params, debug=True)
# _end = time()
# print('elapsed', _end - _start)

from openpose import OpenPose
pe = OpenPose(tmp=tmp)

name = 'cvpr_kth_' + seq1_zipname
predictions = pe.predict(Im, name, FRAME)

Humans = predictions

from mvpose.baseline.baseline import estimate

H, Hypothesis = estimate(Calib,
                         predictions,
                         epi_threshold=100,
                         scale_to_mm=1000,
                         get_hypothesis=True)

fig = plt.figure(figsize=(16, 12))

colors = ['red', 'blue', 'green', 'teal']
Example #5
0
from openpose import OpenPose

pe = OpenPose(tmp=tmp)

poses_per_frame = []
start_frame = 300
end_frame = 600
actual_frames = list(range(start_frame, end_frame))

calib = None
_start = time()
Imgs = {}
for t in range(start_frame, end_frame):
    Im, _, calib = shelf.get(root, t)
    Imgs[t] = Im
    predictions = pe.predict(Im, 'cvpr_shelf', t)
    poses_per_frame.append(predictions)
print('extract poses from ' +\
      str(end_frame - start_frame) + ' frames')
print('\telapsed:', time() - _start)

_start = time()
tracks = tracking(calib, poses_per_frame,
                  actual_frames=actual_frames,
                  epi_threshold=70,
                  scale_to_mm=1000,
                  max_distance_between_tracks=200,
                  min_track_length=10,
                  merge_distance=80,
                  last_seen_delay=15)
print('extract ' + str(len(tracks)) + ' tracks')