Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
162 commits
Select commit Hold shift + click to select a range
702fbef
Minor variable name update for clarity
ebianchi Mar 7, 2024
6d45ff1
Make separate vision project configuration files; use 'video_dir' as …
ebianchi Mar 7, 2024
4eb7940
WIP Changes for new file structure with tracking and nesting run IDs
ebianchi Mar 7, 2024
93ccab5
Use new parameter naming in old run file
ebianchi Mar 7, 2024
bb2f943
Use new variable name
ebianchi Mar 7, 2024
7d5f835
WIP Updates to bundlesdf.py for new file structure changes
ebianchi Mar 7, 2024
e1043d9
Remove data_preparation script in bundlenets repo, rely on cnets-data…
ebianchi Mar 7, 2024
c5dc8d5
Use new variable name
ebianchi Mar 7, 2024
69a75de
Introduce file utility file for file management
ebianchi Mar 7, 2024
2ea33cc
Include minor PLL updates
ebianchi Mar 7, 2024
77811ce
Move BundleSDF source files to repo subdirectory for file management
ebianchi Mar 8, 2024
9c4617a
Correct imports with new file structure
ebianchi Mar 8, 2024
1d02aec
PLL file structure updates for single- and multi-toss consistency
ebianchi Mar 11, 2024
96fac9d
Ignore new geometry data directory contents
ebianchi Mar 13, 2024
7a77804
Draft changes for file structure reorganization
ebianchi Mar 14, 2024
d789c7a
Remove previously stored results outside experiment results folders
ebianchi Mar 14, 2024
29062ea
Draft partial gradient loss calculation
ebianchi Mar 18, 2024
cb57df8
Fix syntax errors in assert statements
ebianchi Mar 18, 2024
66b9028
Small tweaks after testing code in docker
ebianchi Mar 20, 2024
2aff911
Small tweaks after testing code with PLL inputs in docker
ebianchi Mar 20, 2024
62b2cfc
Add back in ability to compute PLL-related losses without using for t…
ebianchi Mar 25, 2024
189bde3
Include table height calibrations
ebianchi Apr 1, 2024
eb84276
Update BundleSDF to PLL trajectory conversion to use automatically de…
ebianchi Apr 1, 2024
a1d30cc
pll to bsdf conversion with tagslam trajectory.
minghanz Apr 2, 2024
6ebdd38
Tweak BundleSDF-related PLL output generation
ebianchi Apr 10, 2024
a0f7447
Attempt to fix submodule error
ebianchi Apr 10, 2024
9ae6ae3
Add more file utilities for accessing data input directories
ebianchi Apr 14, 2024
c454ad9
New dataset creation process from data generation submodule
ebianchi Apr 14, 2024
0567924
Dataset creation updates from ROS bags, time synchronization
ebianchi Apr 15, 2024
b855a4f
debug iteration negative one
minghanz Apr 16, 2024
0c356b3
Added functionality to inspect camera alignments to help diagnose dep…
ebianchi Apr 19, 2024
a73016f
Merge branch 'structural-changes' of https://github.com/ChrisSun99/bu…
ebianchi Apr 19, 2024
5ab76c4
Conversion updates to move TagSLAM origin conversions out of BundleSD…
ebianchi Apr 22, 2024
0f0acbf
Fix for PLL-to-BundleSDF geometry conversions
ebianchi Apr 22, 2024
0625836
Fix the problem of local submodule commits not logged in remote submo…
ChrisSun99 Apr 24, 2024
02b43ed
Include geometry inspection trajectories for PLL training; can be mis…
ebianchi Apr 24, 2024
d2a99d1
Update dataset creation script
ebianchi Apr 29, 2024
a86cac3
No functional changes; formatting only
ebianchi May 1, 2024
a187c23
Minor PLL updates
ebianchi May 1, 2024
5cfb3cb
Build PLL's ability to use BundleSDF information as geometry prior (u…
ebianchi May 2, 2024
20154e0
Correct conversion from tracking origin in meters to geometry origin …
ebianchi May 6, 2024
083db5d
Add conversion for BundleSDF to supervise PLL geometry
ebianchi May 7, 2024
246b02a
Minor PLL fixes to accept BundleSDF input geometry
ebianchi May 7, 2024
fa14c61
Ref frame conversion comments added. Octree with cnets. Save sdf trai…
ChrisSun99 May 8, 2024
3f17fca
PLL updates to use BundleSDF mesh for visualization and edit loss wei…
ebianchi May 8, 2024
fe6757c
Merge branch 'structural-changes' of https://github.com/ChrisSun99/bu…
ebianchi May 8, 2024
7b812ef
Copy BundleSDF mesh to PLL assets during BSDF-to-PLL conversion
ebianchi May 8, 2024
f160018
Bug fix for pll and pll to bsdf.
minghanz May 8, 2024
13c23a4
Generate meshes with vertex normals for pydrake compatibility; genera…
ebianchi May 9, 2024
876b827
PLL video generation updates for faster training
ebianchi May 9, 2024
adfb1d3
Add ability to learn inertial parameters or not in PLL
ebianchi May 9, 2024
6591bda
Tuning for BundleSDF loss in PLL training
ebianchi May 10, 2024
296de6d
Add ability to supervise PLL's support distances from BundleSDF (curr…
ebianchi May 13, 2024
1b52014
Make overlay videos with BundleSDF-to-PLL conversion by default
ebianchi May 15, 2024
383d6ec
Only render cube at TagSLAM trajectory if the object is the cube
ebianchi May 15, 2024
4b1cf0d
Render TagSLAM pose as triad in video overlays; save to different dir…
ebianchi May 15, 2024
f719eb8
Create and use synchronized TagSLAM poses computed at BundleSDF times…
ebianchi May 15, 2024
deed3c2
Add ability to regenerate TagSLAM-related data without regenerating i…
ebianchi May 15, 2024
dd04db3
Update configs to fix the depth cut-off.
minghanz May 15, 2024
3f0f83c
Process tosses individually when computing table height for multiple …
ebianchi May 15, 2024
32602aa
Compute violation-based loss (or other training loss) on all sets; us…
ebianchi May 16, 2024
177802b
Cast systems to proper type for computing violation based loss
ebianchi May 16, 2024
f813175
Bug fix attempt for casting issue
ebianchi May 16, 2024
eb2031f
Revert type casting fix attempt; avoid computing violation loss on an…
ebianchi May 16, 2024
9b5534f
Adhere to decision to use prediction versus contactnets/vision loss
ebianchi May 16, 2024
43b1be2
Generate overlay images with optimized poses after NeRF training with…
ebianchi May 16, 2024
97d2a1f
Preliminary, unworking progress on evaluation script
ebianchi May 17, 2024
fbd4511
nclude optimized keyframes in trajectory plot in BundleSDF-to-PLL con…
ebianchi May 17, 2024
f840428
Move outdated overlay scripts
ebianchi May 17, 2024
f1ddb5a
Minor asset inspection consolidation edits
ebianchi May 17, 2024
f3ef24f
Add script to help restart a previously started vision PLL experiment
ebianchi May 17, 2024
8171c6d
Consolidate inspection results during BundleSDF to PLL conversion
ebianchi May 17, 2024
bad63a3
Fix PLL memory issue with previous solution
ebianchi May 18, 2024
12bda36
Add toss label overlay to videos
ebianchi May 18, 2024
cf0702e
Allow for conversion of BundleSDF NeRF runs associated with a differe…
ebianchi May 18, 2024
dee618a
Fix bug in interpolation sampling, threshold masks at 200 instead of 0.
minghanz May 19, 2024
352c104
new dataset generation and bsdf_only mode.
minghanz May 20, 2024
010a168
Add camera extrinsics from new tagless dataset collected 5/19/2024
ebianchi May 20, 2024
6a759d1
Test dataset creation without TagSLAM
ebianchi May 20, 2024
9ac9aa4
Test dataset creation on new tagless object
ebianchi May 20, 2024
064d2f5
Remove BundleSDF-to-PLL requirement to convert TagSLAM; include tagle…
ebianchi May 20, 2024
7be3318
Misc minor cleanup
ebianchi May 20, 2024
df89703
Add empty 0th toss to fix config yaml issue
ebianchi May 20, 2024
13eca3e
Corrected as written microseconds to be as intended nanoseconds
ebianchi May 20, 2024
d67bac5
config updated with nsecs and toss frame numbers.
minghanz May 20, 2024
2ca5b3a
Remove lingering old dair_pll source files
ebianchi May 21, 2024
8583b20
Merge branch 'structural-changes' of https://github.com/ChrisSun99/bu…
ebianchi May 21, 2024
37f8a9a
bug fix in toss indication in overlay video
minghanz May 21, 2024
3c48d8b
Fix error when plotting toss with no keyframes; add disclaimer to con…
ebianchi May 21, 2024
8418734
Merge branch 'structural-changes' of https://github.com/ChrisSun99/bu…
ebianchi May 21, 2024
6136ea4
Fix typo
ebianchi May 21, 2024
668dd9c
Ensure no attempts to access annotated poses dir if not used
ebianchi May 21, 2024
04aa8f4
Add functionality to generate dynamics predictions during evaluation
ebianchi May 21, 2024
13b6dae
Fix hyperplane-constrained point generation to filter based on normal…
ebianchi May 22, 2024
eaa313e
Run BundleSDF interface from commandline with flags
ebianchi May 22, 2024
267c456
Ensure geometry used for dynamics predictions respects the learned mesh
ebianchi May 22, 2024
7c054cc
Add way to force a mesh object to be represented as polygon instead o…
ebianchi May 22, 2024
e4fc8c7
Remove redundant adds to python path
ebianchi May 22, 2024
2638216
Generate dynamics predictions and visualize as overlay videos
ebianchi May 22, 2024
668f8b1
Localize tosses and frame indices for contact data for Bsdf; need to …
ebianchi May 23, 2024
040482a
Export toss and frame indices for every contact-related export for Bsdf
ebianchi May 23, 2024
f4afa2c
Toss/frame fixes from PLL
ebianchi May 23, 2024
6069441
Minor updates required for PLL-to-Bsdf conversion with toss/frame ind…
ebianchi May 23, 2024
9cdb395
Minor fixes for evaluation
ebianchi May 23, 2024
5b1f80f
Create contact_in_cam directory inside BundleSDF geometry directory (…
ebianchi May 23, 2024
0bf5fef
Verify contact_in_cam assets with visualization
ebianchi May 23, 2024
a8408fc
submodule updated
minghanz May 23, 2024
af75425
Initial progress on trajectory error metrics
ebianchi May 24, 2024
d94e17d
Merge branch 'structural-changes' of https://github.com/ChrisSun99/bu…
ebianchi May 24, 2024
bac08a9
Use different quaternion error metric; avoids over 180-degree error p…
ebianchi May 24, 2024
77cb916
Tracking-related error metrics compute; still to be tested on more data
ebianchi May 25, 2024
15c75ec
Make trajectory format conversion functions cleaner; eliminated TagSL…
ebianchi May 25, 2024
1e750a7
Add ability to generate and visualize toss predictions beyond the exp…
ebianchi May 26, 2024
1f2a94e
Minor type checking correction
ebianchi May 26, 2024
816af28
Prepare for adjusting the start frame for dynamics predictions; numbe…
ebianchi May 28, 2024
d89bf18
Write results to yaml file for dynamics and tracking; geometry TBD
ebianchi May 29, 2024
73be881
Necessary fix and tweaks to get evaluation metrics for BundleSDF iter…
ebianchi May 29, 2024
314fdb7
Can compute results for PLL runs and BundleSDF runs without needing t…
ebianchi May 30, 2024
97a4291
Include other mesh name to replace in evaluation
ebianchi May 30, 2024
2c0e2ee
Fix issue to find obj of different than expected name
ebianchi May 30, 2024
abdefd4
Fix evaluation, minor bug
ebianchi May 30, 2024
f0e1976
Code for rescaling scans according to real and CAD measurements
ebianchi May 30, 2024
99d59b3
Implement single-step dynamics predictions in evaluation
ebianchi May 30, 2024
9ae80a8
Script to help adjust start frames for dynamics predictions
ebianchi May 30, 2024
e3b55da
Annotate start_adjusts for all but croc assets to be used
ebianchi May 31, 2024
c3a7529
Mesh processing for croc; comment updates for start adjustments
ebianchi May 31, 2024
e280f91
Add in geometry metrics to evaluation
ebianchi May 31, 2024
63691df
Evaluation bug fix for PLL-only results with .obj files of unexpected…
ebianchi May 31, 2024
64f7f01
Fix BundleSDF-only evaluation issue; clearly label evaluation folder …
ebianchi May 31, 2024
74fc7c3
Add way to compute AUC from previously generated results
ebianchi May 31, 2024
5e7d8c6
Add method to scrape all results and combine into stored yaml files
ebianchi May 31, 2024
afab08e
Add in mistakenly left out full tracking results from evaluation
ebianchi May 31, 2024
9880517
Redesign the final results file structure
ebianchi May 31, 2024
a6ce42f
Add way to replace only tracking results for evaluation
ebianchi May 31, 2024
fe9515d
Minor fixes for evaluation/results gathering
minghanz May 31, 2024
97a48da
Fix AUC calculation if area is 0; update results yaml comment
ebianchi May 31, 2024
996233e
Initial plotting script demo
ebianchi May 31, 2024
b8e00d3
Results gathering and plotting updates
ebianchi Jun 1, 2024
7b603d3
Accept PLL contact points as contact_in_cam
minghanz Jun 8, 2024
b576309
Merge branch 'structural-changes' of github.com:ChrisSun99/bundlenets…
minghanz Jun 8, 2024
a39af68
Ground truth mesh alignment progress, using mix of manual and automat…
ebianchi Jun 9, 2024
3502821
Merge branch 'structural-changes' of https://github.com/ChrisSun99/bu…
ebianchi Jun 9, 2024
7a8e024
Bundlesdf with convexity vision loss (set -cvw={convexity_vision_weig…
minghanz Jul 30, 2024
7ba75c8
Scripts to check if results are generated normally after batched jobs.
minghanz Jul 30, 2024
2af11ed
PLL updates in preparation for robot interaction experiments
ebianchi Aug 3, 2024
0a8b0a4
Merge branch 'structural-changes' of https://github.com/ChrisSun99/bu…
ebianchi Aug 3, 2024
093d24b
A series of changes related to octree, convexity, occlusion, output, …
minghanz Sep 5, 2024
8c2956f
Submodules updated.
minghanz Sep 5, 2024
9b39646
Adding offset_frames option.
minghanz Sep 27, 2024
cf761ec
Works for robotocc experiments.
minghanz Feb 7, 2025
d02113f
Step towards unifying robot dynamics predictions with other results
ebianchi Feb 18, 2025
536ef12
Allow pose graph optimization on tracking results.
minghanz Apr 20, 2025
df2a050
Rewriting train_loop() in nerf_runner.py for better readability.
minghanz Apr 20, 2025
67ff172
Set default params of bundlesdf and pll to the ones used in the final…
minghanz Apr 21, 2025
4532ff7
Work in a unified docker env.
minghanz Jun 7, 2025
47d327e
Refine the script to initialize the docker container and update the r…
minghanz Jun 9, 2025
12288bc
Update dockerfile for open3d compatibility.
minghanz Jun 18, 2025
7deabe0
visualization code change in cnets-data-gen
minghanz Jun 19, 2025
013d883
Update readme
minghanz Jun 20, 2025
a038f04
Relocation of obselete files and update of readme and media.
minghanz Jun 21, 2025
ace4d75
Update obselete files and dair_pll commit.
minghanz Jun 21, 2025
1270d83
Fix dair_pll commit.
minghanz Jun 21, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
10 changes: 9 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -137,19 +137,27 @@ dmypy.json
.pyre/

# Datasets
data_by*
data/
data_cube_2/
logs/
results/
results_by*
geometry/
output/
dataset/
!BundleTrack/XMem/inference/data
run_used.yml
cn_traj/
frames_annotated*
frames_to_annotate*

# IDE
.vscode

# Data files
*.npy
*.png
*.obj
*.obj
!media/*
!assets/**/*
4 changes: 3 additions & 1 deletion BundleTrack/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -27,4 +27,6 @@ lf-net-release/release
masks/
*.tar.gz
*.pth
!SwiftNet/swiftnet_resnet18_old.pth
!SwiftNet/swiftnet_resnet18_old.pth

LoFTR/weights
2 changes: 1 addition & 1 deletion BundleTrack/LoFTR/demo/demo_loftr.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
import numpy as np
import matplotlib.cm as cm

os.sys.path.append("../") # Add the project directory
os.sys.path.append("../") # Add the BundleTrack project directory
from src.loftr import LoFTR, default_cfg
from src.config.default import get_cfg_defaults
try:
Expand Down
8 changes: 7 additions & 1 deletion BundleTrack/config_behave.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,10 @@
data_dir: /mnt/9a72c439-d0a7-45e8-8d20-d7a235d02763/DATASET/behave/BOWEN_ADDON/Date03_Sub03_boxmedium.2.color
# NOTE: This is NOT the BundleSDF configuration file for BundleSDF/PLL
# collaboration project. Make edits in assets/config_toss_nerf.yml instead for
# that project.

bundlesdf_run_id: null # To be filled in for an experiment.

video_dir: /mnt/9a72c439-d0a7-45e8-8d20-d7a235d02763/DATASET/behave/BOWEN_ADDON/Date03_Sub03_boxmedium.2.color
model_name: textured_simple
model_dir: ""
debug_dir: /home/bowen/debug/BundleTrack/
Expand Down
8 changes: 7 additions & 1 deletion BundleTrack/config_ho3d.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,10 @@
data_dir: /mnt/9a72c439-d0a7-45e8-8d20-d7a235d02763/DATASET/HO3D_v3/evaluation/SM1
# NOTE: This is NOT the BundleSDF configuration file for BundleSDF/PLL
# collaboration project. Make edits in assets/config_toss_nerf.yml instead for
# that project.

bundlesdf_run_id: null # To be filled in for an experiment.

video_dir: /mnt/9a72c439-d0a7-45e8-8d20-d7a235d02763/DATASET/HO3D_v3/evaluation/SM1
model_name: textured_simple
model_dir: ""
debug_dir: /home/bowen/debug/BundleTrack/
Expand Down
121 changes: 121 additions & 0 deletions BundleTrack/config_toss.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,121 @@
# BundleSDF configuration file for BundleSDF/PLL collaboration project.

bundlesdf_run_id: null # To be filled in for an experiment.

video_dir: /mnt/9a72c439-d0a7-45e8-8d20-d7a235d02763/DATASET/HO3D_v3/evaluation/SM1
model_name: textured_simple
model_dir: ""
debug_dir: /home/bowen/debug/BundleTrack/
init_pose_dir: ""
SPDLOG: 2
port: '5555'
seg_port: '1111'
nerf_port: "9999"

toss_frames: []

visible_angle: 70 # Angle between normal and point to camera origin within XXX
# is regarded as visible
erode_mask: 3

segmentation:
ob_scales: [0.3,0.3,0.3]
tolerance: 0.03

depth_processing:
zfar: 2.0 # 1 is too small for cube dataset
erode:
radius: 1
diff: 0.001
ratio: 0.8 #if ratio larger than this, depth set to 0
bilateral_filter:
radius: 2
sigma_D: 2
sigma_R: 100000
outlier_removal:
num: 30
std_mul: 3
edge_normal_thres: 10 #deg between normal and ray
denoise_cloud: False
percentile: 95

bundle:
num_iter_outter: 7
num_iter_inner: 5
window_size: 5 #exclude keyframes, include new frame
max_BA_frames: 10
subset_selection_method: normal_orientation_nearest
depth_association_radius: 5 # 0: findDenseCorr;
# 1: findDenseCorrNearestNeighbor3D
non_neighbor_max_rot: 90
non_neighbor_min_visible: 0.1 # ratio of pixel visible
icp_pose_rot_thres: 60 # Rotation larger than XX deg is ignored for icp
w_rpi: 0
w_p2p: 1 # Used in loss.cpp
w_fm: 1
w_sdf: 0
w_pm: 0
robust_delta: 0.005
min_fm_edges_newframe: 15
image_downscale: [4]
feature_edge_dist_thres: 0.01
feature_edge_normal_thres: 30 # Normal angle should be within this range
max_optimized_feature_loss: 0.03

keyframe:
min_interval: 1
min_feat_num: 0
min_trans: 0
min_rot: 10 # 5
min_visible: 1

sift:
scales: [2,4,8]
max_match_per_query: 5
nOctaveLayers: 3
contrastThreshold: 0.01
edgeThreshold: 50
sigma: 1.6

feature_corres:
mutual: True
map_points: True
max_dist_no_neighbor: 0.02 # 0.01
max_normal_no_neighbor: 45 # 20
max_dist_neighbor: 0.03 # 0.02
max_normal_neighbor: 45 # 30
suppression_patch_size: 5
max_view_normal_angle: 180
min_match_with_ref: 5
resize: 400
rematch_after_nerf: True

ransac:
max_iter: 2000
num_sample: 3
inlier_dist: 0.01
inlier_normal_angle: 20
desired_succ_rate: 0.99
max_trans_neighbor: 0.02 #ransac model estimated pose shouldnt be too far
max_rot_deg_neighbor: 30
max_trans_no_neighbor: 0.01
max_rot_no_neighbor: 10
epipolar_thres: 1
min_match_after_ransac: 5

p2p:
projective: false
max_dist: 0.02
max_normal_angle: 45

sdf_edge:
max_dist: 0.02

shape:
res: 0.005
xrange: [-0.2,0.2]
yrange: [-0.2,0.2]
zrange: [-0.2,0.2]
max_weight: 100
truncate_dist: 0.005

8 changes: 7 additions & 1 deletion BundleTrack/config_ycbineoat.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,10 @@
data_dir: /home/bowen/debug/ycbineoat
# NOTE: This is NOT the BundleSDF configuration file for BundleSDF/PLL
# collaboration project. Make edits in assets/config_toss_nerf.yml instead for
# that project.

bundlesdf_run_id: null # To be filled in for an experiment.

video_dir: /home/bowen/debug/ycbineoat
model_name: textured_simple
model_dir: ""
debug_dir: /home/bowen/debug/BundleTrack/
Expand Down
27 changes: 18 additions & 9 deletions BundleTrack/scripts/data_reader.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,16 +13,25 @@
yaml = ruamel.yaml.YAML()
code_dir = os.path.dirname(os.path.realpath(__file__))
sys.path.append(f'{code_dir}/../../')
from Utils import *
from bundlenets.Utils import *

HO3D_ROOT = '/mnt/9a72c439-d0a7-45e8-8d20-d7a235d02763/DATASET/HO3D_v3'


class YcbineoatReader:
def __init__(self,video_dir, downscale=1, shorter_side=None):
def __init__(self,video_dir, downscale=1, shorter_side=None, occluded=None,offset_frames=1):
self.video_dir = video_dir
self.downscale = downscale
self.color_files = sorted(glob.glob(f"{self.video_dir}/rgb/*.png"))
occ_label = '' if occluded is None else f'_{occluded}'
offset_label = '' if offset_frames == 1 else f'_offset_{offset_frames}'
self.rgb_folder = f'rgb{occ_label}{offset_label}'
self.mask_folder = f'masks{occ_label}{offset_label}'
self.depth_folder = f'depth{offset_label}'
self.gt_pose_folder = f'annotated_poses{offset_label}'
# Check if depth folder exists
if not os.path.exists(f"{self.video_dir}/{self.depth_folder}"):
self.depth_folder = 'depth'
self.color_files = sorted(glob.glob(f"{self.video_dir}/{self.rgb_folder}/*.png"))
self.K = np.loadtxt(f'{video_dir}/cam_K.txt').reshape(3,3)
self.id_strs = []
for color_file in self.color_files:
Expand All @@ -37,7 +46,7 @@ def __init__(self,video_dir, downscale=1, shorter_side=None):
self.W = int(self.W*self.downscale)
self.K[:2] *= self.downscale

self.gt_pose_files = sorted(glob.glob(f'{self.video_dir}/annotated_poses/*'))
self.gt_pose_files = sorted(glob.glob(f'{self.video_dir}/{self.gt_pose_folder}/*'))

self.videoname_to_object = {
'bleach0': "021_bleach_cleanser",
Expand Down Expand Up @@ -73,14 +82,14 @@ def get_color(self,i):
return color

def get_mask(self,i):
mask = cv2.imread(self.color_files[i].replace('rgb','masks'),-1)
mask = cv2.imread(self.color_files[i].replace(self.rgb_folder, self.mask_folder),-1)
if len(mask.shape)==3:
mask = (mask.sum(axis=-1)>0).astype(np.uint8)
mask = cv2.resize(mask, (self.W,self.H), interpolation=cv2.INTER_NEAREST)
return mask

def get_depth(self,i):
depth = cv2.imread(self.color_files[i].replace('rgb','depth'),-1)/1e3
depth = cv2.imread(self.color_files[i].replace(self.rgb_folder, self.depth_folder),-1)/1e3
depth = cv2.resize(depth, (self.W,self.H), interpolation=cv2.INTER_NEAREST)
return depth

Expand All @@ -91,12 +100,12 @@ def get_xyz_map(self,i):
return xyz_map

def get_occ_mask(self,i):
hand_mask_file = self.color_files[i].replace('rgb','masks_hand')
hand_mask_file = self.color_files[i].replace(self.rgb_folder,'masks_hand')
occ_mask = np.zeros((self.H,self.W), dtype=bool)
if os.path.exists(hand_mask_file):
occ_mask = occ_mask | (cv2.imread(hand_mask_file,-1)>0)

right_hand_mask_file = self.color_files[i].replace('rgb','masks_hand_right')
right_hand_mask_file = self.color_files[i].replace(self.rgb_folder,'masks_hand_right')
if os.path.exists(right_hand_mask_file):
occ_mask = occ_mask | (cv2.imread(right_hand_mask_file,-1)>0)

Expand Down Expand Up @@ -181,5 +190,5 @@ def get_gt_pose(self,i):
else:
ob_in_cam_gt[:3,3] = meta['objTrans']
ob_in_cam_gt[:3,:3] = cv2.Rodrigues(meta['objRot'].reshape(3))[0]
ob_in_cam_gt = glcam_in_cvcam@ob_in_cam_gt
ob_in_cam_gt = GLCAM_IN_CVCAM@ob_in_cam_gt
return ob_in_cam_gt
4 changes: 3 additions & 1 deletion BundleTrack/src/Bundler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -262,7 +262,9 @@ void Bundler::processNewFrame(std::shared_ptr<Frame> frame)

bool Bundler::checkAndAddKeyframe(std::shared_ptr<Frame> frame)
{
if (frame->_id==0)
const auto toss_frames = (*yml)["toss_frames"].as<std::vector<int>>();
int cnt = count(toss_frames.begin(), toss_frames.end(), frame->_id + 1);
if (frame->_id==0 || cnt>0)
{
_keyframes.push_back(frame);
SPDLOG("Added frame {} as keyframe, current #keyframe: {}", frame->_id_str, _keyframes.size());
Expand Down
Loading