Skip to content

Commit

Permalink
trim 3D labeling code, make it work with optimized data
Browse files Browse the repository at this point in the history
  • Loading branch information
lambdaloop committed Aug 19, 2019
1 parent 00f1f44 commit 3023903
Showing 1 changed file with 6 additions and 20 deletions.
26 changes: 6 additions & 20 deletions anipose/label_videos_3d.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,24 +41,6 @@ def update_all_lines(lines, points, scheme, bp_dict):
for line, bps in zip(lines, scheme):
update_line(line, points, bps, bp_dict)

def get_points(dx, bodyparts):
points = [(dx[bp+'_x'], dx[bp+'_y'], dx[bp+'_z']) for bp in bodyparts]
# scores = [dx[bp+'_score'] for bp in bodyparts]
errors = np.array([dx[bp+'_error'] for bp in bodyparts])
ncams = np.array([dx[bp+'_ncams'] for bp in bodyparts])
# good = (np.array(scores) > 0.1) & (np.array(errors) < 35)

## TODO: add checking on scores here
## TODO: make error thresholds configurable
errors[np.isnan(errors)] = 10000
ncams[np.isnan(ncams)] = 0
good = (errors < 30) #& (ncams >= 3)

points = np.array(points)
points[~good] = np.nan

return points



def visualize_labels(config, labels_fname, outname, fps=300):
Expand Down Expand Up @@ -87,8 +69,12 @@ def visualize_labels(config, labels_fname, outname, fps=300):
all_scores = np.array([np.array(data.loc[:, bp+'_score'])
for bp in bodyparts])

all_errors[np.isnan(all_errors)] = 10000
good = (all_errors < 30)

if config['triangulation']['optim']:
all_errors[np.isnan(all_errors)] = 0
else:
all_errors[np.isnan(all_errors)] = 10000
good = (all_errors < 100)
all_points[~good] = np.nan

all_points_flat = all_points.reshape(-1, 3)
Expand Down

0 comments on commit 3023903

Please sign in to comment.