upd
This commit is contained in:
parent
47624f12cf
commit
2dfb6c57ce
@ -15,7 +15,7 @@ runner:
|
||||
- OmniObject3d_test
|
||||
|
||||
blender_script_path: "/media/hofee/data/project/python/nbv_reconstruction/blender/data_renderer.py"
|
||||
output_dir: "/media/hofee/data/results/nbv_rec_inference/global_only_ycb_241204"
|
||||
output_dir: " /media/hofee/data/data/temp"
|
||||
pipeline: nbv_reconstruction_pipeline
|
||||
voxel_size: 0.003
|
||||
min_new_area: 1.0
|
||||
@ -34,8 +34,8 @@ dataset:
|
||||
# load_from_preprocess: True
|
||||
|
||||
OmniObject3d_test:
|
||||
root_dir: "/media/hofee/data/results/ycb_preprocessed_dataset"
|
||||
model_dir: "/media/hofee/data/data/ycb_obj"
|
||||
root_dir: "/media/hofee/data/data/new_testset_output"
|
||||
model_dir: "/media/hofee/data/data/scaled_object_meshes"
|
||||
source: seq_reconstruction_dataset_preprocessed
|
||||
# split_file: "C:\\Document\\Datasets\\data_list\\OmniObject3d_test.txt"
|
||||
type: test
|
||||
|
@ -15,13 +15,13 @@ runner:
|
||||
overlap_area_threshold: 30
|
||||
compute_with_normal: False
|
||||
scan_points_threshold: 10
|
||||
overwrite: False
|
||||
overwrite: False
|
||||
seq_num: 10
|
||||
dataset_list:
|
||||
- OmniObject3d
|
||||
|
||||
datasets:
|
||||
OmniObject3d:
|
||||
root_dir: /media/hofee/data/results/ycb_view_data
|
||||
root_dir: /media/hofee/data/data/test_bottle/view
|
||||
from: 0
|
||||
to: -1 # ..-1 means end
|
||||
|
@ -8,11 +8,11 @@ runner:
|
||||
root_dir: experiments
|
||||
generate:
|
||||
port: 5002
|
||||
from: 1
|
||||
from: 0
|
||||
to: 50 # -1 means all
|
||||
object_dir: /media/hofee/data/data/ycb_obj
|
||||
object_dir: /media/hofee/data/data/test_bottle/bottle_mesh
|
||||
table_model_path: /media/hofee/data/data/others/table.obj
|
||||
output_dir: /media/hofee/data/results/ycb_view_data
|
||||
output_dir: /media/hofee/data/data/test_bottle/view
|
||||
binocular_vision: true
|
||||
plane_size: 10
|
||||
max_views: 512
|
||||
@ -34,7 +34,7 @@ runner:
|
||||
max_y: 0.05
|
||||
min_z: 0.01
|
||||
max_z: 0.01
|
||||
random_rotation_ratio: 0.3
|
||||
random_rotation_ratio: 0.0
|
||||
random_objects:
|
||||
num: 4
|
||||
cluster: 0.9
|
||||
|
@ -63,11 +63,15 @@ class SeqReconstructionDataset(BaseDataset):
|
||||
scene_max_cr_idx = 0
|
||||
frame_len = DataLoadUtil.get_scene_seq_length(self.root_dir, scene_name)
|
||||
|
||||
for i in range(frame_len):
|
||||
for i in range(10,frame_len):
|
||||
path = DataLoadUtil.get_path(self.root_dir, scene_name, i)
|
||||
pts = DataLoadUtil.load_from_preprocessed_pts(path, "npy")
|
||||
print(pts.shape)
|
||||
if pts.shape[0] == 0:
|
||||
continue
|
||||
else:
|
||||
break
|
||||
print(i)
|
||||
datalist.append({
|
||||
"scene_name": scene_name,
|
||||
"first_frame": i,
|
||||
@ -179,9 +183,9 @@ if __name__ == "__main__":
|
||||
np.random.seed(seed)
|
||||
|
||||
config = {
|
||||
"root_dir": "/media/hofee/data/results/ycb_view_data",
|
||||
"root_dir": "/media/hofee/data/data/test_bottle/view",
|
||||
"source": "seq_reconstruction_dataset",
|
||||
"split_file": "/media/hofee/data/results/ycb_test.txt",
|
||||
"split_file": "/media/hofee/data/data/test_bottle/test_bottle.txt",
|
||||
"load_from_preprocess": True,
|
||||
"filter_degree": 75,
|
||||
"num_workers": 0,
|
||||
@ -189,7 +193,7 @@ if __name__ == "__main__":
|
||||
"type": namespace.Mode.TEST,
|
||||
}
|
||||
|
||||
output_dir = "/media/hofee/data/results/ycb_preprocessed_dataset"
|
||||
output_dir = "/media/hofee/data/data/test_bottle/preprocessed_dataset"
|
||||
os.makedirs(output_dir, exist_ok=True)
|
||||
|
||||
ds = SeqReconstructionDataset(config)
|
||||
|
@ -21,7 +21,7 @@ class SeqReconstructionDatasetPreprocessed(BaseDataset):
|
||||
super(SeqReconstructionDatasetPreprocessed, self).__init__(config)
|
||||
self.config = config
|
||||
self.root_dir = config["root_dir"]
|
||||
self.real_root_dir = r"/media/hofee/data/results/ycb_view_data"
|
||||
self.real_root_dir = r"/media/hofee/data/data/new_testset"
|
||||
self.item_list = os.listdir(self.root_dir)
|
||||
|
||||
def __getitem__(self, index):
|
||||
@ -66,7 +66,7 @@ if __name__ == "__main__":
|
||||
load_from_preprocess: True
|
||||
'''
|
||||
config = {
|
||||
"root_dir": "H:\\AI\\Datasets\\packed_test_data",
|
||||
"root_dir": "/media/hofee/data/data/test_bottle/preprocessed_dataset",
|
||||
"source": "seq_reconstruction_dataset",
|
||||
"split_file": "H:\\AI\\Datasets\\data_list\\OmniObject3d_test.txt",
|
||||
"load_from_preprocess": True,
|
||||
|
@ -164,7 +164,7 @@ def save_scene_data(root, scene, scene_idx=0, scene_total=1,file_type="txt"):
|
||||
|
||||
if __name__ == "__main__":
|
||||
#root = "/media/hofee/repository/new_data_with_normal"
|
||||
root = r"/media/hofee/data/results/ycb_view_data"
|
||||
root = r"/media/hofee/data/data/test_bottle/view"
|
||||
scene_list = os.listdir(root)
|
||||
from_idx = 0 # 1000
|
||||
to_idx = len(scene_list) # 1500
|
||||
|
@ -146,7 +146,21 @@ class Inferencer(Runner):
|
||||
|
||||
pred_pose[:3,:3] = PoseUtil.rotation_6d_to_matrix_tensor_batch(pred_pose_9d[:,:6])[0]
|
||||
pred_pose[:3,3] = pred_pose_9d[0,6:]
|
||||
# ----- Debug -----
|
||||
|
||||
from utils.vis import visualizeUtil
|
||||
import ipdb; ipdb.set_trace()
|
||||
all_directions = []
|
||||
np.savetxt("input_pts.txt", input_data["combined_scanned_pts"].cpu().numpy()[0])
|
||||
for i in range(50):
|
||||
output = self.pipeline(input_data)
|
||||
pred_pose_9d = output["pred_pose_9d"]
|
||||
cam_pos, sample_points = visualizeUtil.get_cam_pose_and_cam_axis(pred_pose_9d.cpu().numpy()[0], is_6d_pose=True)
|
||||
all_directions.append(sample_points)
|
||||
all_directions = np.array(all_directions)
|
||||
reshape_all_directions = all_directions.reshape(-1, 3)
|
||||
np.savetxt("all_directions.txt", reshape_all_directions)
|
||||
# ----- ----- -----
|
||||
try:
|
||||
new_target_pts, new_target_normals, new_scan_points_indices = RenderUtil.render_pts(pred_pose, scene_path, self.script_path, scan_points, voxel_threshold=voxel_threshold, filter_degree=filter_degree, nO_to_nL_pose=O_to_L_pose)
|
||||
#import ipdb; ipdb.set_trace()
|
||||
@ -157,11 +171,11 @@ class Inferencer(Runner):
|
||||
|
||||
downsampled_new_target_pts = PtsUtil.voxel_downsample_point_cloud(new_target_pts, voxel_threshold)
|
||||
overlap, _ = ReconstructionUtil.check_overlap(downsampled_new_target_pts, voxel_downsampled_combined_scanned_pts_np, overlap_area_threshold = curr_overlap_area_threshold, voxel_size=voxel_threshold, require_new_added_pts_num = True)
|
||||
if not overlap:
|
||||
Log.yellow("no overlap!")
|
||||
retry += 1
|
||||
retry_overlap_pose.append(pred_pose.cpu().numpy().tolist())
|
||||
continue
|
||||
# if not overlap:
|
||||
# Log.yellow("no overlap!")
|
||||
# retry += 1
|
||||
# retry_overlap_pose.append(pred_pose.cpu().numpy().tolist())
|
||||
# continue
|
||||
|
||||
history_indices.append(new_scan_points_indices)
|
||||
except Exception as e:
|
||||
|
@ -84,10 +84,12 @@ class RenderUtil:
|
||||
params_data_path = os.path.join(temp_dir, "params.json")
|
||||
with open(params_data_path, 'w') as f:
|
||||
json.dump(params, f)
|
||||
#import ipdb; ipdb.set_trace()
|
||||
result = subprocess.run([
|
||||
'/home/hofee/blender-4.0.2-linux-x64/blender', '-b', '-P', script_path, '--', temp_dir
|
||||
], capture_output=True, text=True)
|
||||
#print(result)
|
||||
#import ipdb; ipdb.set_trace()
|
||||
path = os.path.join(temp_dir, "tmp")
|
||||
cam_info = DataLoadUtil.load_cam_info(path, binocular=True)
|
||||
depth_L, depth_R = DataLoadUtil.load_depth(
|
||||
|
18
utils/vis.py
18
utils/vis.py
@ -7,6 +7,7 @@ import trimesh
|
||||
sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
|
||||
from utils.data_load import DataLoadUtil
|
||||
from utils.pts import PtsUtil
|
||||
from utils.pose import PoseUtil
|
||||
|
||||
class visualizeUtil:
|
||||
|
||||
@ -33,7 +34,22 @@ class visualizeUtil:
|
||||
all_cam_axis = np.array(all_cam_axis).reshape(-1, 3)
|
||||
np.savetxt(os.path.join(output_dir, "all_cam_pos.txt"), all_cam_pos)
|
||||
np.savetxt(os.path.join(output_dir, "all_cam_axis.txt"), all_cam_axis)
|
||||
|
||||
|
||||
@staticmethod
|
||||
def get_cam_pose_and_cam_axis(cam_pose, is_6d_pose):
|
||||
if is_6d_pose:
|
||||
matrix_cam_pose = np.eye(4)
|
||||
matrix_cam_pose[:3,:3] = PoseUtil.rotation_6d_to_matrix_numpy(cam_pose[:6])
|
||||
matrix_cam_pose[:3, 3] = cam_pose[6:]
|
||||
else:
|
||||
matrix_cam_pose = cam_pose
|
||||
cam_pos = matrix_cam_pose[:3, 3]
|
||||
cam_axis = matrix_cam_pose[:3, 2]
|
||||
num_samples = 10
|
||||
sample_points = [cam_pos + 0.02*t * cam_axis for t in range(num_samples)]
|
||||
sample_points = np.array(sample_points)
|
||||
return cam_pos, sample_points
|
||||
|
||||
@staticmethod
|
||||
def save_all_combined_pts(root, scene, output_dir):
|
||||
length = DataLoadUtil.get_scene_seq_length(root, scene)
|
||||
|
Loading…
x
Reference in New Issue
Block a user