add blender app

This commit is contained in:
hofee 2024-09-05 01:32:50 +08:00
parent 129bcb872e
commit da00ecca90
183 changed files with 4241 additions and 3 deletions

BIN
.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.0 MiB

View File

@ -1,8 +1,8 @@
from PytorchBoot.application import PytorchBootApplication
from runners.strategy_generator import StrategyGenerator
@PytorchBootApplication("generate")
class GenerateApp:
@PytorchBootApplication("generate_strategy")
class DataGenerateApp:
@staticmethod
def start():
StrategyGenerator("configs/strategy_generate_config.yaml").run()

16
app_generate_view.py Normal file
View File

@ -0,0 +1,16 @@
from PytorchBoot.application import PytorchBootApplication
from runners.view_generator import ViewGenerator
@PytorchBootApplication("generate_view")
class ViewGenerateApp:
@staticmethod
def start():
'''
call default or your custom runners here, code will be executed
automatically when type "pytorch-boot run" or "ptb run" in terminal
example:
Trainer("path_to_your_train_config").run()
Evaluator("path_to_your_eval_config").run()
'''
ViewGenerator("./configs/view_generate_config.yaml").run()

View File

@ -1,7 +1,7 @@
from PytorchBoot.application import PytorchBootApplication
from runners.data_spliter import DataSpliter
@PytorchBootApplication("split")
@PytorchBootApplication("split_data")
class DataSplitApp:
@staticmethod
def start():

322
blender/blender_util.py Normal file
View File

@ -0,0 +1,322 @@
import os
import json
import bpy
import gc
import numpy as np
import mathutils
class BlenderUtils:
TABLE_NAME: str = "table"
CAMERA_NAME: str = "Camera"
CAMERA_RIGHT_NAME: str = "CameraRight"
CAMERA_OBJECT_NAME: str = "CameraObject"
LIGHT_NAME: str = "Light"
DISPLAY_TABLE_NAME: str = "display_table"
MESH_FILE_NAME: str = "mesh.obj"
@staticmethod
def get_obj_path(obj_dir, name):
return os.path.join(obj_dir, name, BlenderUtils.MESH_FILE_NAME)
@staticmethod
def load_obj(name, mesh_path, scale=1):
bpy.ops.wm.obj_import(filepath=mesh_path)
loaded_object = bpy.context.selected_objects[-1]
loaded_object.name = name
loaded_object.data.name = name
loaded_object.scale = (scale, scale, scale)
bpy.ops.rigidbody.object_add()
return loaded_object
@staticmethod
def get_obj(name):
return bpy.data.objects.get(name)
@staticmethod
def set_obj_at(name, pose):
pass
@staticmethod
def get_obj_pose(name):
obj = BlenderUtils.get_obj(name)
return np.asarray(obj.matrix_world)
@staticmethod
def add_plane(name, location, orientation, size=10):
bpy.ops.mesh.primitive_plane_add(size=size,location=location)
plane = bpy.context.selected_objects[-1]
plane.name = name
plane.rotation_euler = orientation
bpy.ops.rigidbody.object_add()
bpy.context.object.rigid_body.type = 'PASSIVE'
@staticmethod
def add_table(table_model_path):
table = BlenderUtils.load_obj(BlenderUtils.TABLE_NAME, table_model_path, scale=0.01)
bpy.ops.rigidbody.object_add()
bpy.context.object.rigid_body.type = 'PASSIVE'
mat = bpy.data.materials.new(name="TableYellowMaterial")
mat.diffuse_color = (1.0, 1.0, 0.0, 1.0)
if len(table.data.materials) > 0:
table.data.materials[0] = mat
else:
table.data.materials.append(mat)
@staticmethod
def setup_scene(init_light_and_camera_config, table_model_path, binocular_vision):
BlenderUtils.init_light_and_camera(init_light_and_camera_config, binocular_vision)
BlenderUtils.add_plane("plane_floor", location=(0,0,0), orientation=(0,0,0))
BlenderUtils.add_plane("plane_ceil", location=(0,0,10), orientation=(0,0,0))
BlenderUtils.add_plane("plane_wall_1", location=(5,0,5), orientation=(0,np.pi/2,0))
BlenderUtils.add_plane("plane_wall_2", location=(-5,0,5), orientation=(0,np.pi/2,0))
BlenderUtils.add_plane("plane_wall_3", location=(0,5,5), orientation=(np.pi/2,0,0))
BlenderUtils.add_plane("plane_wall_4", location=(0,-5,5), orientation=(np.pi/2,0,0))
BlenderUtils.add_table(table_model_path)
@staticmethod
def set_light_params(light, config):
light.location = config["location"]
light.rotation_euler = config["orientation"]
if light.type == 'SUN':
light.data.energy = config["power"]
elif light.type == 'POINT':
light.data.energy = config["power"]
@staticmethod
def set_camera_params(camera, config, binocular_vision):
camera_object = bpy.data.objects.new(BlenderUtils.CAMERA_OBJECT_NAME, None)
bpy.context.collection.objects.link(camera_object)
cameras = [bpy.data.objects.get("Camera")]
camera.location = [0,0,0]
camera.rotation_euler = [0,0,0]
camera.parent = camera_object
if binocular_vision:
left_camera = cameras[0]
right_camera = left_camera.copy()
right_camera.name = BlenderUtils.CAMERA_RIGHT_NAME
right_camera.data = left_camera.data.copy()
right_camera.data.name = BlenderUtils.CAMERA_RIGHT_NAME
bpy.context.collection.objects.link(right_camera)
right_camera.parent = camera_object
right_camera.location = [config["eye_distance"]/2, 0, 0]
left_camera.location = [-config["eye_distance"]/2, 0, 0]
cameras.append(right_camera)
for camera in cameras:
camera.data.clip_start = config["near_plane"]
camera.data.clip_end = config["far_plane"]
bpy.context.scene.render.resolution_x = config["resolution"][0]
bpy.context.scene.render.resolution_y = config["resolution"][1]
sensor_height = 24.0
focal_length = sensor_height / (2 * np.tan(np.radians(config["fov_vertical"]) / 2))
camera.data.lens = focal_length
camera.data.sensor_width = sensor_height * config["resolution"][0] / config["resolution"][1]
camera.data.sensor_height = sensor_height
@staticmethod
def init_light_and_camera(init_light_and_camera_config, binocular_vision):
camera = BlenderUtils.get_obj(BlenderUtils.CAMERA_NAME)
light = BlenderUtils.get_obj(BlenderUtils.LIGHT_NAME)
BlenderUtils.set_camera_params(camera, init_light_and_camera_config[BlenderUtils.CAMERA_NAME], binocular_vision)
BlenderUtils.set_light_params(light, init_light_and_camera_config[BlenderUtils.LIGHT_NAME])
@staticmethod
def get_obj_diag(name):
obj = BlenderUtils.get_obj(name)
return np.linalg.norm(obj.dimensions)
@staticmethod
def matrix_to_blender_pose(matrix):
location = matrix[:3, 3]
rotation_matrix = matrix[:3, :3]
rotation_matrix_blender = mathutils.Matrix(rotation_matrix.tolist())
rotation_euler = rotation_matrix_blender.to_euler()
return location, rotation_euler
@staticmethod
def set_camera_at(pose):
camera = BlenderUtils.get_obj(BlenderUtils.CAMERA_OBJECT_NAME)
location, rotation_euler = BlenderUtils.matrix_to_blender_pose(pose)
camera.location = location
camera.rotation_euler = rotation_euler
@staticmethod
def get_object_bottom_z(obj):
vertices = [v.co for v in obj.data.vertices]
vertices_world = [obj.matrix_world @ v for v in vertices]
min_z = min([v.z for v in vertices_world])
return min_z
@staticmethod
def render_and_save(output_dir, file_name, target_name, frame_num="0120", binocular_vision=False, render_rgb=False):
target_cameras = [BlenderUtils.CAMERA_NAME]
if binocular_vision:
target_cameras.append(BlenderUtils.CAMERA_RIGHT_NAME)
for cam_name in target_cameras:
# Set the current camera
bpy.context.scene.camera = BlenderUtils.get_obj(cam_name)
bpy.context.scene.view_layers["ViewLayer"].use_pass_z = True
cam_suffix = "L" if cam_name == BlenderUtils.CAMERA_NAME else "R"
scene = bpy.context.scene
scene.render.filepath = ""
if render_rgb:
rgb_dir = os.path.join(output_dir, "rgb")
if not os.path.exists(rgb_dir):
os.makedirs(rgb_dir)
# Modify the file name based on the camera
scene.render.filepath = os.path.join(output_dir, rgb_dir, f"{file_name}_{cam_suffix}.png")
scene.render.image_settings.color_depth = '16'
scene.render.resolution_percentage = 100
scene.render.use_overwrite = False
scene.render.use_file_extension = False
scene.render.use_placeholder = False
scene.use_nodes = True
tree = scene.node_tree
for node in tree.nodes:
tree.nodes.remove(node)
rl = tree.nodes.new('CompositorNodeRLayers')
map_range = tree.nodes.new('CompositorNodeMapRange')
map_range.inputs['From Min'].default_value = 0.01
map_range.inputs['From Max'].default_value = 5
map_range.inputs['To Min'].default_value = 0
map_range.inputs['To Max'].default_value = 1
tree.links.new(rl.outputs['Depth'], map_range.inputs[0])
output_depth = tree.nodes.new('CompositorNodeOutputFile')
depth_dir = os.path.join(output_dir, "depth")
if not os.path.exists(depth_dir):
os.makedirs(depth_dir)
output_depth.base_path = depth_dir
output_depth.file_slots[0].path = f"{file_name}_{cam_suffix}.####"
output_depth.format.file_format = 'PNG'
output_depth.format.color_mode = 'BW'
output_depth.format.color_depth = '16'
tree.links.new(map_range.outputs[0], output_depth.inputs[0])
bpy.context.scene.view_layers["ViewLayer"].use_pass_cryptomatte_object = True
crypto_node = scene.node_tree.nodes.new("CompositorNodeCryptomatteV2")
crypto_node.matte_id = target_name
output_mask = scene.node_tree.nodes.new("CompositorNodeOutputFile")
mask_dir = os.path.join(output_dir, "mask")
if not os.path.exists(mask_dir):
os.makedirs(mask_dir)
output_mask.base_path = mask_dir
output_mask.file_slots[0].path = f"{file_name}_{cam_suffix}.####"
output_mask.format.file_format = 'PNG'
output_mask.format.color_mode = 'RGB'
output_mask.format.color_depth = '8'
scene.node_tree.links.new(crypto_node.outputs[1], output_mask.inputs[0])
bpy.ops.render.render(write_still=True)
os.rename(os.path.join(depth_dir, f"{file_name}_{cam_suffix}.{frame_num}.png"), os.path.join(depth_dir, f"{file_name}_{cam_suffix}.png"))
os.rename(os.path.join(mask_dir, f"{file_name}_{cam_suffix}.{frame_num}.png"), os.path.join(mask_dir, f"{file_name}_{cam_suffix}.png"))
@staticmethod
def save_cam_params(scene_dir, idx, binocular_vision=False):
camera = BlenderUtils.get_obj(BlenderUtils.CAMERA_NAME)
extrinsic = np.array(camera.matrix_world @ camera.matrix_local)
cam_data = camera.data
focal_length = cam_data.lens
sensor_width = cam_data.sensor_width
sensor_height = cam_data.sensor_height
resolution_x = bpy.context.scene.render.resolution_x
resolution_y = bpy.context.scene.render.resolution_y
intrinsic = np.zeros((3, 3))
intrinsic[0, 0] = focal_length * resolution_x / sensor_width # fx
intrinsic[1, 1] = focal_length * resolution_y / sensor_height # fy
intrinsic[0, 2] = resolution_x / 2.0 # cx
intrinsic[1, 2] = resolution_y / 2.0 # cy
intrinsic[2, 2] = 1.0
cam_object = BlenderUtils.get_obj(BlenderUtils.CAMERA_OBJECT_NAME)
extrinsic_cam_object = np.array(cam_object.matrix_world)
data = {
"extrinsic": extrinsic.tolist(),
"extrinsic_cam_object": extrinsic_cam_object.tolist(),
"intrinsic": intrinsic.tolist(),
"far_plane": camera.data.clip_end,
"near_plane": camera.data.clip_start,
}
if binocular_vision:
right_camera = BlenderUtils.get_obj(BlenderUtils.CAMERA_RIGHT_NAME)
extrinsic_right = np.array(right_camera.matrix_world @ right_camera.matrix_local)
data["extrinsic_R"] = extrinsic_right.tolist()
cam_params_dir = os.path.join(scene_dir, "camera_params")
if not os.path.exists(cam_params_dir):
os.makedirs(cam_params_dir)
cam_params_path = os.path.join(cam_params_dir, f"{idx}.json")
with open(cam_params_path, "w") as f:
json.dump(data, f, indent=4)
@staticmethod
def reset_objects_and_platform():
all_objects = bpy.data.objects
keep_objects = {"plane_floor", "plane_ceil", "plane_wall_1", "plane_wall_2", "plane_wall_3", "plane_wall_4"}
keep_objects.add(BlenderUtils.CAMERA_OBJECT_NAME)
keep_objects.add(BlenderUtils.CAMERA_NAME)
keep_objects.add(BlenderUtils.CAMERA_RIGHT_NAME)
keep_objects.add(BlenderUtils.LIGHT_NAME)
keep_objects.add(BlenderUtils.TABLE_NAME)
for obj in all_objects:
if obj.name not in keep_objects:
bpy.data.objects.remove(obj, do_unlink=True)
for block in bpy.data.meshes:
if block.users == 0:
bpy.data.meshes.remove(block)
for block in bpy.data.materials:
if block.users == 0:
bpy.data.materials.remove(block)
for block in bpy.data.images:
if block.users == 0:
bpy.data.images.remove(block)
gc.collect()
bpy.context.scene.frame_set(0)
@staticmethod
def save_scene_info(scene_root_dir, display_table_config, target_name):
all_objects = bpy.data.objects
no_save_objects = {"plane_floor", "plane_ceil", "plane_wall_1", "plane_wall_2", "plane_wall_3", "plane_wall_4"}
no_save_objects.add(BlenderUtils.CAMERA_OBJECT_NAME)
no_save_objects.add(BlenderUtils.CAMERA_NAME)
no_save_objects.add(BlenderUtils.CAMERA_RIGHT_NAME)
no_save_objects.add(BlenderUtils.LIGHT_NAME)
no_save_objects.add(BlenderUtils.TABLE_NAME)
scene_info = {}
for obj in all_objects:
if obj.name not in no_save_objects and obj.name != BlenderUtils.DISPLAY_TABLE_NAME:
obj_info = {
"location": list(obj.location),
"rotation_euler": list(obj.rotation_euler),
"scale": list(obj.scale)
}
scene_info[obj.name] = obj_info
scene_info[BlenderUtils.DISPLAY_TABLE_NAME] = display_table_config
scene_info["target_name"] = target_name
scene_info_path = os.path.join(scene_root_dir, "scene_info.json")
with open(scene_info_path, "w") as outfile:
json.dump(scene_info, outfile)

320
blender/data_generator.py Normal file
View File

@ -0,0 +1,320 @@
import os
import random
import math
import bpy
import numpy as np
import mathutils
import requests
from blender.blender_util import BlenderUtils
from blender.view_sample_util import ViewSampleUtil
class DataGenerator:
def __init__(self, config):
self.plane_size = config["runner"]["generate"]["plane_size"]
self.table_model_path = config["runner"]["generate"]["table_model_path"]
self.output_dir = config["runner"]["generate"]["output_dir"]
self.random_config = config["runner"]["generate"]["random_config"]
self.light_and_camera_config = config["runner"]["generate"]["light_and_camera_config"]
self.obj_dir = config["runner"]["generate"]["object_dir"]
self.max_views = config["runner"]["generate"]["max_views"]
self.binocular_vision = config["runner"]["generate"]["binocular_vision"]
self.set_status_path = "http://localhost:5000/project/set_status"
self.log_path = "http://localhost:5000/project/add_log"
self.obj_name_list = os.listdir(self.obj_dir)
self.target_obj = None
self.stopped = False
self.random_obj_list = []
self.display_table_config = {}
BlenderUtils.setup_scene(self.light_and_camera_config, self.table_model_path, self.binocular_vision)
self.table = BlenderUtils.get_obj(BlenderUtils.TABLE_NAME)
self.access = self._check_set_status_access(self.set_status_path)
print(self.access)
def _check_set_status_access(self, url):
try:
response = requests.get(url, timeout=5)
return True
except requests.RequestException as e:
print(f"Cannot access {url}: {e}")
return False
def set_status(self, key, value):
if not self.access:
return
request_data = {}
request_data["status"] = {
"app_name" : "generate_view",
"runner_name" : "view_generator",
"key": key,
"value": value
}
requests.post(self.set_status_path, json=request_data)
def set_progress(self, key, curr_value, max_value):
if not self.access:
return
request_data = {}
request_data["progress"] = {
"app_name" : "generate_view",
"runner_name" : "view_generator",
"key": key,
"curr_value": curr_value,
"max_value": max_value
}
requests.post(self.set_status_path, json=request_data)
def add_log(self, msg, log_type):
if not self.access:
return
request_data = {"log":{}}
request_data["log"]["message"] = msg
request_data["log"]["log_type"] = log_type
requests.post(self.log_path, json=request_data)
def generate_display_platform(self):
config = self.random_config[BlenderUtils.DISPLAY_TABLE_NAME]
height = random.uniform(config["min_height"], config["max_height"])
radius = random.uniform(config["min_radius"], config["max_radius"])
R = random.uniform(config["min_R"], config["max_R"])
G = random.uniform(config["min_G"], config["max_G"])
B = random.uniform(config["min_B"], config["max_B"])
while height > 0.5 * radius:
height = random.uniform(config["min_height"], config["max_height"])
bpy.ops.mesh.primitive_cylinder_add(radius=radius, depth=height)
platform = bpy.context.selected_objects[-1]
platform.name = BlenderUtils.DISPLAY_TABLE_NAME
bbox = self.table.bound_box
bbox_world = [self.table.matrix_world @ mathutils.Vector(corner) for corner in bbox]
table_top_z = max([v.z for v in bbox_world])
platform.location = (0, 0, table_top_z + height / 2)
bpy.ops.rigidbody.object_add()
bpy.context.object.rigid_body.type = 'PASSIVE'
bpy.ops.object.shade_auto_smooth()
mat = bpy.data.materials.new(name="DarkGrayMaterial")
mat.diffuse_color = (R, G, B, 1.0)
if len(platform.data.materials) > 0:
platform.data.materials[0] = mat
else:
platform.data.materials.append(mat)
self.display_table_config = {
"height": height,
"radius": radius,
"R": R,
"G": G,
"B": B,
"location": list(platform.location)
}
return platform
def put_display_object(self, name):
config = self.random_config["display_object"]
x = random.uniform(config["min_x"], config["max_x"])
y = random.uniform(config["min_y"], config["max_y"])
z = random.uniform(config["min_z"], config["max_z"])
if random.random() <= config["random_rotation_ratio"]:
rotation = (
random.uniform(0, 2*np.pi),
random.uniform(0, 2*np.pi),
random.uniform(0, 2*np.pi)
)
else:
rotation = (0, 0, 0)
z=0.05
platform_bbox = self.platform.bound_box
platform_bbox_world = [self.platform.matrix_world @ mathutils.Vector(corner) for corner in platform_bbox]
platform_top_z = max([v.z for v in platform_bbox_world])
obj_mesh_path = BlenderUtils.get_obj_path(self.obj_dir,name)
obj = BlenderUtils.load_obj(name, obj_mesh_path)
obj_bottom_z = BlenderUtils.get_object_bottom_z(obj)
offset_z = obj_bottom_z
obj.rotation_euler = rotation
obj.location = (x, y, platform_top_z - offset_z + z)
bpy.ops.rigidbody.object_add()
bpy.context.object.rigid_body.type = 'ACTIVE'
self.target_obj = obj
def put_random_objects_on_table(self):
num_objects = self.random_config["random_objects"]["num"]
cluster = self.random_config["random_objects"]["cluster"]
for _ in range(num_objects):
obj_name = random.choice(self.obj_name_list)
obj_mesh_path = BlenderUtils.get_obj_path(self.obj_dir, obj_name)
obj = BlenderUtils.load_obj(obj_name, obj_mesh_path)
bbox = self.table.bound_box
bbox_world = [self.table.matrix_world @ mathutils.Vector(corner) for corner in bbox]
table_top_z = max([v.z for v in bbox_world])
platform_radius = self.platform.dimensions.x / 2.0
while True:
x = random.uniform(bbox_world[0].x*cluster, bbox_world[6].x*cluster)
y = random.uniform(bbox_world[0].y*cluster, bbox_world[6].y*cluster)
if math.sqrt(x**2 + y**2) > platform_radius*4:
break
rotation = (
random.uniform(0, 2 * np.pi),
random.uniform(0, 2 * np.pi),
random.uniform(0, 2 * np.pi)
)
obj_bottom_z = BlenderUtils.get_object_bottom_z(obj)
offset_z = obj_bottom_z
obj.rotation_euler = rotation
obj.location = (x, y, table_top_z - offset_z)
bpy.ops.rigidbody.object_add()
bpy.context.object.rigid_body.type = 'ACTIVE'
self.random_obj_list.append(obj)
def reset(self):
self.target_obj = None
self.random_obj_list = []
BlenderUtils.reset_objects_and_platform()
def check_moving_objects(self, previous_locations):
threshold = 0.01
moving_objects = False
target_checking_object = [self.target_obj] + self.random_obj_list
for obj in target_checking_object:
if obj.rigid_body:
current_location = obj.location
location_diff = (current_location - previous_locations[obj.name]).length
if location_diff > threshold:
moving_objects = True
break
return moving_objects
def check_and_adjust_target(self):
target_position = self.target_obj.matrix_world.translation
msg = "success"
if abs(target_position[0]) > self.random_config["display_object"]["max_x"]:
target_position[0] = np.sign(target_position[0]) * self.random_config["display_object"]["max_x"]*random.uniform(-0.5,0.5)
msg = "adjusted"
if abs(target_position[1]) > self.random_config["display_object"]["max_y"]:
target_position[1] = np.sign(target_position[1]) * self.random_config["display_object"]["max_y"]*random.uniform(-0.5,0.5)
msg = "adjusted"
if target_position[2] < 0.85:
target_position[2] = target_position[2] + 0.1
msg = "adjusted"
self.target_obj.location = target_position
return msg
def start_render(self):
object_name = self.target_obj.name
if "." in object_name:
object_name = object_name.split(".")[0]
scene_dir = os.path.join(self.output_dir, object_name)
if not os.path.exists(scene_dir):
os.makedirs(scene_dir)
view_data = ViewSampleUtil.sample_view_data_world_space(self.target_obj, distance_range=(0.3,0.5), voxel_size=0.005, max_views=self.max_views)
object_points = np.array(view_data["voxel_down_sampled_points"])
normals = np.array(view_data["normals"])
points_normals = np.concatenate((object_points, normals), axis=1)
np.savetxt(os.path.join(scene_dir, "points_and_normals.txt"), points_normals)
for i, cam_pose in enumerate(view_data["cam_poses"]):
BlenderUtils.set_camera_at(cam_pose)
BlenderUtils.render_and_save(scene_dir, f"{i}", object_name, binocular_vision=self.binocular_vision)
BlenderUtils.save_cam_params(scene_dir, i, binocular_vision=self.binocular_vision)
self.set_progress("render frame", i, len(view_data["cam_poses"]))
self.set_progress("render frame", len(view_data["cam_poses"]), len(view_data["cam_poses"]))
BlenderUtils.save_scene_info(scene_dir, self.display_table_config, object_name)
def simulate_scene(self, frame_limit=120, depth = 0):
bpy.context.view_layer.update()
bpy.ops.screen.animation_play()
previous_locations = {obj.name: obj.matrix_world.translation.copy() for obj in bpy.context.scene.objects if obj.rigid_body}
frame_count = 1
moving_objects = True
while frame_count < frame_limit:
bpy.context.view_layer.update()
if frame_count%10 == 0:
moving_objects = self.check_moving_objects(previous_locations)
if not moving_objects:
break
frame_count += 1
bpy.context.scene.frame_set(bpy.context.scene.frame_current + 1)
previous_locations = {obj.name: obj.matrix_world.translation.copy() for obj in bpy.context.scene.objects if obj.rigid_body}
bpy.ops.screen.animation_cancel(restore_frame=False)
msg = self.check_and_adjust_target()
if msg == "adjusted" and depth < 3:
bpy.context.view_layer.update()
bpy.context.scene.frame_set(0)
return self.simulate_scene(depth = depth + 1)
elif msg == "success":
print("Scene generation completed.")
self.start_render()
return msg
return "retry"
def gen_scene_data(self, object_name):
bpy.context.scene.frame_set(0)
self.platform = self.generate_display_platform()
self.put_display_object(object_name)
diag = BlenderUtils.get_obj_diag(self.target_obj.name)
self.set_status("target_diagonal", diag)
if diag > 0.7 or diag < 0.1:
self.add_log(f"The diagonal size of the object <{object_name}>(size: {round(diag,3)}) does not meet the requirements.", "error")
return "diag_error"
self.put_random_objects_on_table()
return self.simulate_scene()
def gen_all_scene_data(self):
max_retry_times = 3
total = len(self.obj_name_list)
count = 0
count_success = 0
self.set_progress("generate scene", 0, total)
result = "retry"
for target_obj_name in self.obj_name_list:
self.add_log(f"Generating scene for object <{target_obj_name}>", "info")
retry_times = 0
self.set_status("target_object", target_obj_name)
while retry_times < 3 and result == "retry":
self.reset()
try:
result = self.gen_scene_data(target_obj_name)
except Exception as e:
self.add_log(f"Uknown error: {e}", "error")
result = "unknown_error"
if result == "retry":
retry_times += 1
self.add_log(f"Maximum adjust times, retrying <{target_obj_name}>. ({retry_times}/{max_retry_times}) ", "warning")
count += 1
if result == "success":
count_success += 1
self.add_log(f"Scene for object <{target_obj_name}> generated successfully", "success")
if result == "retry" and retry_times >= max_retry_times:
self.add_log(f"Maximum retries, failed to generate scene for object <{target_obj_name}>", "error")
self.set_status("success", count_success)
self.set_status("fail", count - count_success)
self.set_progress("generate scene", count, total)
result = "retry"

14
blender/run_blender.py Normal file
View File

@ -0,0 +1,14 @@
import os
import sys
sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
import yaml
from blender.data_generator import DataGenerator
if __name__ == "__main__":
config_path = sys.argv[sys.argv.index('--') + 1]
with open(config_path, "r") as file:
config = yaml.safe_load(file)
dg = DataGenerator(config)
dg.gen_all_scene_data()

130
blender/view_sample_util.py Normal file
View File

@ -0,0 +1,130 @@
import numpy as np
import bmesh
from collections import defaultdict
class ViewSampleUtil:
@staticmethod
def voxel_downsample(points, voxel_size):
voxel_grid = defaultdict(list)
for i, point in enumerate(points):
voxel_index = tuple((point // voxel_size).astype(int))
voxel_grid[voxel_index].append(i)
downsampled_points = []
downsampled_indices = []
for indices in voxel_grid.values():
selected_index = indices[0]
downsampled_points.append(points[selected_index])
downsampled_indices.append(selected_index)
return np.array(downsampled_points), downsampled_indices
@staticmethod
def sample_view_data(obj, distance_range:tuple = (0.3,0.5), voxel_size:float = 0.005, max_views: int = 1) -> dict:
view_data = {
"look_at_points": [],
"cam_positions": [],
}
mesh = obj.data
bm = bmesh.new()
bm.from_mesh(mesh)
bm.verts.ensure_lookup_table()
bm.faces.ensure_lookup_table()
bm.normal_update()
look_at_points = []
cam_positions = []
normals = []
for v in bm.verts:
look_at_point = np.array(v.co)
view_data["look_at_points"].append(look_at_point)
normal = np.zeros(3)
for loop in v.link_loops:
normal += np.array(loop.calc_normal())
normal /= len(v.link_loops)
normal = normal / np.linalg.norm(normal)
if np.isnan(normal).any():
continue
if np.dot(normal, look_at_point) < 0:
normal = -normal
distance = np.random.uniform(*distance_range)
cam_position = look_at_point + distance * normal
look_at_points.append(look_at_point)
cam_positions.append(cam_position)
normals.append(normal)
bm.free()
look_at_points = np.array(look_at_points)
cam_positions = np.array(cam_positions)
voxel_downsampled_look_at_points, selected_indices = ViewSampleUtil.voxel_downsample(look_at_points, voxel_size)
voxel_downsampled_cam_positions = cam_positions[selected_indices]
voxel_downsampled_normals = np.array(normals)[selected_indices]
if len(voxel_downsampled_look_at_points) > max_views*2:
indices = np.random.choice(len(voxel_downsampled_look_at_points), max_views*2, replace=False)
downsampled_look_at_points = voxel_downsampled_look_at_points[indices]
downsampled_cam_positions = voxel_downsampled_cam_positions[indices]
view_data["look_at_points"] = downsampled_look_at_points.tolist()
view_data["cam_positions"] = downsampled_cam_positions.tolist()
view_data["normals"] = voxel_downsampled_normals
view_data["voxel_down_sampled_points"] = voxel_downsampled_look_at_points
return view_data
@staticmethod
def get_world_points_and_normals(view_data: dict, obj_world_pose: np.ndarray) -> tuple:
world_points = []
world_normals = []
for voxel_down_sampled_points, normal in zip(view_data["voxel_down_sampled_points"], view_data["normals"]):
voxel_down_sampled_points_world = obj_world_pose @ np.append(voxel_down_sampled_points, 1.0)
normal_world = obj_world_pose[:3, :3] @ normal
world_points.append(voxel_down_sampled_points_world[:3])
world_normals.append(normal_world)
return np.array(world_points), np.array(world_normals)
@staticmethod
def get_cam_pose(view_data: dict, obj_world_pose: np.ndarray, max_views: int) -> np.ndarray:
cam_poses = []
min_height_z = 1000
for look_at_point, cam_position in zip(view_data["look_at_points"], view_data["cam_positions"]):
look_at_point_world = obj_world_pose @ np.append(look_at_point, 1.0)
cam_position_world = obj_world_pose @ np.append(cam_position, 1.0)
if look_at_point_world[2] < min_height_z:
min_height_z = look_at_point_world[2]
look_at_point_world = look_at_point_world[:3]
cam_position_world = cam_position_world[:3]
forward_vector = cam_position_world - look_at_point_world
forward_vector /= np.linalg.norm(forward_vector)
up_vector = np.array([0, 0, 1])
right_vector = np.cross(up_vector, forward_vector)
right_vector /= np.linalg.norm(right_vector)
corrected_up_vector = np.cross(forward_vector, right_vector)
rotation_matrix = np.array([right_vector, corrected_up_vector, forward_vector]).T
cam_pose = np.eye(4)
cam_pose[:3, :3] = rotation_matrix
cam_pose[:3, 3] = cam_position_world
cam_poses.append(cam_pose)
filtered_cam_poses = []
for cam_pose in cam_poses:
if cam_pose[2, 3] > min_height_z:
filtered_cam_poses.append(cam_pose)
if len(filtered_cam_poses) > max_views:
indices = np.random.choice(len(filtered_cam_poses), max_views, replace=False)
filtered_cam_poses = [filtered_cam_poses[i] for i in indices]
return np.array(filtered_cam_poses)
@staticmethod
def sample_view_data_world_space(obj, distance_range:tuple = (0.3,0.5), voxel_size:float = 0.005, max_views: int=1) -> dict:
obj_world_pose = np.asarray(obj.matrix_world)
view_data = ViewSampleUtil.sample_view_data(obj, distance_range, voxel_size, max_views)
view_data["cam_poses"] = ViewSampleUtil.get_cam_pose(view_data, obj_world_pose, max_views)
view_data["voxel_down_sampled_points"], view_data["normals"] = ViewSampleUtil.get_world_points_and_normals(view_data, obj_world_pose)
return view_data

View File

@ -0,0 +1,49 @@
runner:
general:
seed: 0
device: cpu
cuda_visible_devices: 0,1,2,3,4,5,6,7
experiment:
name: debug
root_dir: experiments
generate:
object_dir: H:\AI\Datasets\scaled_object_meshes
table_model_path: C:\Users\hofee\Desktop\blender\table.obj
output_dir: C:\Document\Local Project\nbv_rec\nbv_reconstruction\temp
binocular_vision: true
plane_size: 10
max_views: 10
random_config:
display_table:
min_height: 0.05
max_height: 0.15
min_radius: 0.1
max_radius: 0.2
min_R: 0.05
max_R: 0.3
min_G: 0.05
max_G: 0.3
min_B: 0.05
max_B: 0.3
display_object:
min_x: 0
max_x: 0.03
min_y: 0
max_y: 0.03
min_z: 0.01
max_z: 0.01
random_rotation_ratio: 0.3
random_objects:
num: 4
cluster: 0.9
light_and_camera_config:
Camera:
near_plane: 0.01
far_plane: 5
fov_vertical: 25
resolution: [1280,800]
eye_distance: 0.06
Light:
location: [0,0,3.5]
orientation: [0,0,0]
power: 150

18
runners/view_generator.py Normal file
View File

@ -0,0 +1,18 @@
import subprocess
from PytorchBoot.runners.runner import Runner
import PytorchBoot.stereotype as stereotype
@stereotype.runner("view_generator")
class ViewGenerator(Runner):
def __init__(self, config_path):
super().__init__(config_path)
self.config_path = config_path
def run(self):
subprocess.run(['blender', '-b', '-P', './blender/run_blender.py', '--', self.config_path])
def create_experiment(self, backup_name=None):
return super().create_experiment(backup_name)
def load_experiment(self, backup_name=None):
super().load_experiment(backup_name)

View File

@ -0,0 +1,99 @@
{
"extrinsic": [
[
0.07150819897651672,
0.571461021900177,
-0.8175077438354492,
-0.534420907497406
],
[
-0.9974400401115417,
0.04096903279423714,
-0.058608539402484894,
0.058449406176805496
],
[
-5.187591689548299e-09,
0.8196058869361877,
0.572927713394165,
1.3510252237319946
],
[
0.0,
0.0,
0.0,
1.0
]
],
"extrinsic_cam_object": [
[
0.07150819897651672,
0.571461021900177,
-0.8175077438354492,
-0.5301303863525391
],
[
-0.9974400401115417,
0.04096902906894684,
-0.058608539402484894,
-0.0013969995779916644
],
[
0.0,
0.8196058869361877,
0.572927713394165,
1.3510252237319946
],
[
0.0,
0.0,
0.0,
1.0
]
],
"intrinsic": [
[
1804.283324707217,
0.0,
640.0
],
[
0.0,
1804.2833964029949,
400.0
],
[
0.0,
0.0,
1.0
]
],
"far_plane": 5.0,
"near_plane": 0.009999999776482582,
"extrinsic_R": [
[
0.07150819897651672,
0.571461021900177,
-0.8175077438354492,
-0.5258399844169617
],
[
-0.9974400401115417,
0.04096903279423714,
-0.058608539402484894,
-0.06124339997768402
],
[
-5.187591689548299e-09,
0.8196058869361877,
0.572927713394165,
1.3510252237319946
],
[
0.0,
0.0,
0.0,
1.0
]
]
}

View File

@ -0,0 +1,99 @@
{
"extrinsic": [
[
-0.9200537204742432,
-0.36793825030326843,
0.1346207559108734,
-0.011971847154200077
],
[
0.39179250597953796,
-0.8640364408493042,
0.31613245606422424,
0.010695301927626133
],
[
0.0,
0.34360218048095703,
0.9391154050827026,
1.4907959699630737
],
[
0.0,
0.0,
0.0,
1.0
]
],
"extrinsic_cam_object": [
[
-0.9200536012649536,
-0.3679382801055908,
0.13462072610855103,
-0.06717509031295776
],
[
0.3917924463748932,
-0.8640364408493042,
0.31613239645957947,
0.034202806651592255
],
[
0.0,
0.34360215067863464,
0.9391152858734131,
1.4907959699630737
],
[
0.0,
0.0,
0.0,
1.0
]
],
"intrinsic": [
[
1804.283324707217,
0.0,
640.0
],
[
0.0,
1804.2833964029949,
400.0
],
[
0.0,
0.0,
1.0
]
],
"far_plane": 5.0,
"near_plane": 0.009999999776482582,
"extrinsic_R": [
[
-0.9200537204742432,
-0.36793825030326843,
0.1346207559108734,
-0.12237827479839325
],
[
0.39179250597953796,
-0.8640364408493042,
0.31613245606422424,
0.057710401713848114
],
[
0.0,
0.34360218048095703,
0.9391154050827026,
1.4907959699630737
],
[
0.0,
0.0,
0.0,
1.0
]
]
}

View File

@ -0,0 +1,99 @@
{
"extrinsic": [
[
0.22581711411476135,
-0.9548897743225098,
0.1928526908159256,
-0.06708569079637527
],
[
0.9741697311401367,
0.22134792804718018,
-0.04470415785908699,
0.06478184461593628
],
[
-3.6515626078426067e-09,
0.19796618819236755,
0.9802088737487793,
1.5601288080215454
],
[
0.0,
0.0,
0.0,
1.0
]
],
"extrinsic_cam_object": [
[
0.22581711411476135,
-0.9548897743225098,
0.1928526610136032,
-0.05353667214512825
],
[
0.9741697311401367,
0.22134792804718018,
-0.04470415040850639,
0.12323202937841415
],
[
0.0,
0.19796618819236755,
0.9802088737487793,
1.5601288080215454
],
[
0.0,
0.0,
0.0,
1.0
]
],
"intrinsic": [
[
1804.283324707217,
0.0,
640.0
],
[
0.0,
1804.2833964029949,
400.0
],
[
0.0,
0.0,
1.0
]
],
"far_plane": 5.0,
"near_plane": 0.009999999776482582,
"extrinsic_R": [
[
0.22581711411476135,
-0.9548897743225098,
0.1928526908159256,
-0.03998764604330063
],
[
0.9741697311401367,
0.22134792804718018,
-0.04470415785908699,
0.18168221414089203
],
[
-3.6515626078426067e-09,
0.19796618819236755,
0.9802088737487793,
1.5601288080215454
],
[
0.0,
0.0,
0.0,
1.0
]
]
}

View File

@ -0,0 +1,99 @@
{
"extrinsic": [
[
-0.49073153734207153,
0.512611985206604,
-0.7045647501945496,
-0.37789463996887207
],
[
-0.871310830116272,
-0.28870853781700134,
0.3968183696269989,
0.40368467569351196
],
[
0.0,
0.8086261749267578,
0.5883227586746216,
1.4329079389572144
],
[
0.0,
0.0,
0.0,
1.0
]
],
"extrinsic_cam_object": [
[
-0.49073153734207153,
0.512611985206604,
-0.7045647501945496,
-0.40733852982521057
],
[
-0.871310830116272,
-0.28870853781700134,
0.3968183696269989,
0.3514060378074646
],
[
0.0,
0.8086261749267578,
0.5883227586746216,
1.4329079389572144
],
[
0.0,
0.0,
0.0,
1.0
]
],
"intrinsic": [
[
1804.283324707217,
0.0,
640.0
],
[
0.0,
1804.2833964029949,
400.0
],
[
0.0,
0.0,
1.0
]
],
"far_plane": 5.0,
"near_plane": 0.009999999776482582,
"extrinsic_R": [
[
-0.49073153734207153,
0.512611985206604,
-0.7045647501945496,
-0.43678247928619385
],
[
-0.871310830116272,
-0.28870853781700134,
0.3968183696269989,
0.29912739992141724
],
[
0.0,
0.8086261749267578,
0.5883227586746216,
1.4329079389572144
],
[
0.0,
0.0,
0.0,
1.0
]
]
}

View File

@ -0,0 +1,99 @@
{
"extrinsic": [
[
-0.41841641068458557,
-0.22861123085021973,
0.8790134191513062,
0.47779136896133423
],
[
0.9082552194595337,
-0.10531696677207947,
0.4049452543258667,
0.05622487887740135
],
[
0.0,
0.9678043127059937,
0.25170373916625977,
1.1846224069595337
],
[
0.0,
0.0,
0.0,
1.0
]
],
"extrinsic_cam_object": [
[
-0.41841644048690796,
-0.22861124575138092,
0.8790134191513062,
0.4526864290237427
],
[
0.9082552790641785,
-0.10531698167324066,
0.4049452543258667,
0.1107202097773552
],
[
0.0,
0.9678043127059937,
0.25170373916625977,
1.1846224069595337
],
[
0.0,
0.0,
0.0,
1.0
]
],
"intrinsic": [
[
1804.283324707217,
0.0,
640.0
],
[
0.0,
1804.2833964029949,
400.0
],
[
0.0,
0.0,
1.0
]
],
"far_plane": 5.0,
"near_plane": 0.009999999776482582,
"extrinsic_R": [
[
-0.41841641068458557,
-0.22861123085021973,
0.8790134191513062,
0.42758142948150635
],
[
0.9082552194595337,
-0.10531696677207947,
0.4049452543258667,
0.16521553695201874
],
[
0.0,
0.9678043127059937,
0.25170373916625977,
1.1846224069595337
],
[
0.0,
0.0,
0.0,
1.0
]
]
}

View File

@ -0,0 +1,99 @@
{
"extrinsic": [
[
-0.9947221875190735,
0.026164468377828598,
-0.09921203553676605,
-0.04230757802724838
],
[
-0.10260412842035294,
-0.2536582350730896,
0.9618367552757263,
0.5610079169273376
],
[
0.0,
0.9669399857521057,
0.25500407814979553,
1.2528464794158936
],
[
0.0,
0.0,
0.0,
1.0
]
],
"extrinsic_cam_object": [
[
-0.9947222471237183,
0.026164472103118896,
-0.09921204298734665,
-0.10199091583490372
],
[
-0.10260413587093353,
-0.2536582350730896,
0.9618367552757263,
0.5548517107963562
],
[
0.0,
0.9669399857521057,
0.25500407814979553,
1.2528464794158936
],
[
0.0,
0.0,
0.0,
1.0
]
],
"intrinsic": [
[
1804.283324707217,
0.0,
640.0
],
[
0.0,
1804.2833964029949,
400.0
],
[
0.0,
0.0,
1.0
]
],
"far_plane": 5.0,
"near_plane": 0.009999999776482582,
"extrinsic_R": [
[
-0.9947221875190735,
0.026164468377828598,
-0.09921203553676605,
-0.16167426109313965
],
[
-0.10260412842035294,
-0.2536582350730896,
0.9618367552757263,
0.5486955046653748
],
[
0.0,
0.9669399857521057,
0.25500407814979553,
1.2528464794158936
],
[
0.0,
0.0,
0.0,
1.0
]
]
}

View File

@ -0,0 +1,99 @@
{
"extrinsic": [
[
-0.019944222643971443,
-0.11966041475534439,
-0.9926145076751709,
-0.634463906288147
],
[
-0.9998010993003845,
0.002387009095400572,
0.019800866022706032,
0.2258453518152237
],
[
0.0,
0.9928121566772461,
-0.11968420445919037,
1.0313278436660767
],
[
0.0,
0.0,
0.0,
1.0
]
],
"extrinsic_cam_object": [
[
-0.019944222643971443,
-0.1196603998541832,
-0.9926145076751709,
-0.6356605291366577
],
[
-0.9998010993003845,
0.0023870086297392845,
0.019800864160060883,
0.16585730016231537
],
[
0.0,
0.9928120374679565,
-0.11968420445919037,
1.0313278436660767
],
[
0.0,
0.0,
0.0,
1.0
]
],
"intrinsic": [
[
1804.283324707217,
0.0,
640.0
],
[
0.0,
1804.2833964029949,
400.0
],
[
0.0,
0.0,
1.0
]
],
"far_plane": 5.0,
"near_plane": 0.009999999776482582,
"extrinsic_R": [
[
-0.019944222643971443,
-0.11966041475534439,
-0.9926145076751709,
-0.6368571519851685
],
[
-0.9998010993003845,
0.002387009095400572,
0.019800866022706032,
0.10586923360824585
],
[
0.0,
0.9928121566772461,
-0.11968420445919037,
1.0313278436660767
],
[
0.0,
0.0,
0.0,
1.0
]
]
}

View File

@ -0,0 +1,99 @@
{
"extrinsic": [
[
-0.6142184734344482,
-0.6646955609321594,
0.42534154653549194,
0.1909155249595642
],
[
0.7891359925270081,
-0.5173611044883728,
0.3310616612434387,
0.20455853641033173
],
[
1.6063347985095788e-08,
0.5389965176582336,
0.842307984828949,
1.505414366722107
],
[
0.0,
0.0,
0.0,
1.0
]
],
"extrinsic_cam_object": [
[
-0.6142184734344482,
-0.6646955609321594,
0.42534157633781433,
0.15406236052513123
],
[
0.7891359925270081,
-0.5173611044883728,
0.33106163144111633,
0.2519066631793976
],
[
0.0,
0.5389965176582336,
0.842307984828949,
1.5054142475128174
],
[
0.0,
0.0,
0.0,
1.0
]
],
"intrinsic": [
[
1804.283324707217,
0.0,
640.0
],
[
0.0,
1804.2833964029949,
400.0
],
[
0.0,
0.0,
1.0
]
],
"far_plane": 5.0,
"near_plane": 0.009999999776482582,
"extrinsic_R": [
[
-0.6142184734344482,
-0.6646955609321594,
0.42534154653549194,
0.11720931529998779
],
[
0.7891359925270081,
-0.5173611044883728,
0.3310616612434387,
0.299254834651947
],
[
1.6063347985095788e-08,
0.5389965176582336,
0.842307984828949,
1.505414366722107
],
[
0.0,
0.0,
0.0,
1.0
]
]
}

View File

@ -0,0 +1,99 @@
{
"extrinsic": [
[
-0.031135933473706245,
-0.09473854303359985,
-0.9950151443481445,
-0.4819811284542084
],
[
-0.999515175819397,
0.0029512043111026287,
0.030995754525065422,
0.15077351033687592
],
[
-2.3178239882959417e-10,
0.9954978227615356,
-0.09478449076414108,
1.1755675077438354
],
[
0.0,
0.0,
0.0,
1.0
]
],
"extrinsic_cam_object": [
[
-0.031135933473706245,
-0.09473853558301926,
-0.9950151443481445,
-0.4838492274284363
],
[
-0.999515175819397,
0.0029512038454413414,
0.030995754525065422,
0.09080260246992111
],
[
0.0,
0.9954978227615356,
-0.09478449821472168,
1.175567388534546
],
[
0.0,
0.0,
0.0,
1.0
]
],
"intrinsic": [
[
1804.283324707217,
0.0,
640.0
],
[
0.0,
1804.2833964029949,
400.0
],
[
0.0,
0.0,
1.0
]
],
"far_plane": 5.0,
"near_plane": 0.009999999776482582,
"extrinsic_R": [
[
-0.031135933473706245,
-0.09473854303359985,
-0.9950151443481445,
-0.48571738600730896
],
[
-0.999515175819397,
0.0029512043111026287,
0.030995754525065422,
0.030831700190901756
],
[
-2.3178239882959417e-10,
0.9954978227615356,
-0.09478449076414108,
1.1755675077438354
],
[
0.0,
0.0,
0.0,
1.0
]
]
}

View File

@ -0,0 +1,99 @@
{
"extrinsic": [
[
-0.13570454716682434,
-0.8186439871788025,
0.5580381155014038,
0.3439837694168091
],
[
0.9907494783401489,
-0.11213098466396332,
0.07643537223339081,
-0.09716455638408661
],
[
-6.156322118755497e-09,
0.5632485151290894,
0.8262876868247986,
1.5667630434036255
],
[
0.0,
0.0,
0.0,
1.0
]
],
"extrinsic_cam_object": [
[
-0.13570453226566315,
-0.8186438679695129,
0.558038055896759,
0.3358412981033325
],
[
0.9907493591308594,
-0.11213096976280212,
0.07643537223339081,
-0.037719618529081345
],
[
0.0,
0.5632484555244446,
0.826287567615509,
1.566762924194336
],
[
0.0,
0.0,
0.0,
1.0
]
],
"intrinsic": [
[
1804.283324707217,
0.0,
640.0
],
[
0.0,
1804.2833964029949,
400.0
],
[
0.0,
0.0,
1.0
]
],
"far_plane": 5.0,
"near_plane": 0.009999999776482582,
"extrinsic_R": [
[
-0.13570454716682434,
-0.8186439871788025,
0.5580381155014038,
0.327699214220047
],
[
0.9907494783401489,
-0.11213098466396332,
0.07643537223339081,
0.0217253677546978
],
[
-6.156322118755497e-09,
0.5632485151290894,
0.8262876868247986,
1.5667630434036255
],
[
0.0,
0.0,
0.0,
1.0
]
]
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 235 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 241 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 256 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 240 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 150 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 131 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 260 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 302 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 257 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 274 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 298 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 265 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 199 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 230 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 275 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 219 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 150 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 165 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 240 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 277 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 30 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 24 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 30 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 30 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 28 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 26 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 27 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 28 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 27 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 35 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 30 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 25 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 26 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 28 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 29 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 26 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 22 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 26 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 19 KiB

View File

@ -0,0 +1 @@
{"google_scan-backpack_0288": {"location": [0.013753965497016907, -0.001228367444127798, 1.0540469884872437], "rotation_euler": [-0.009113508276641369, 0.43163615465164185, 0.06773945689201355], "scale": [0.9999999403953552, 1.0, 1.0]}, "omniobject3d-dustbin_008": {"location": [-0.7522230744361877, 0.21507050096988678, 0.9851672649383545], "rotation_euler": [1.602346420288086, 0.2193271815776825, 4.518024921417236], "scale": [1.0, 1.0, 1.0]}, "omniobject3d-mouse_004": {"location": [-0.7120156288146973, -0.23219752311706543, 0.8398286700248718], "rotation_euler": [0.16111688315868378, 1.221889853477478, 1.5239087343215942], "scale": [1.0, 1.0, 1.0]}, "omniobject3d-power_strip_007": {"location": [0.7768751978874207, -0.08161095529794693, 0.8394950032234192], "rotation_euler": [2.4821085929870605, 2.749929428100586, 4.947591781616211], "scale": [1.0, 1.0, 1.0]}, "omniobject3d-toy_bus_008": {"location": [-0.7539269328117371, 0.005644728895276785, 0.840167760848999], "rotation_euler": [1.7060844898223877, 0.04578366130590439, 2.216777801513672], "scale": [1.0, 1.0, 1.0]}, "display_table": {"height": 0.0670081694460248, "radius": 0.18688753562614638, "R": 0.2752451703309917, "G": 0.0644484792614105, "B": 0.2411663793152971, "location": [0.0, 0.0, 0.8553121089935303]}, "target_name": "google_scan-backpack_0288"}

View File

@ -0,0 +1,99 @@
{
"extrinsic": [
[
-0.6613909006118774,
0.5639212131500244,
-0.4945249855518341,
-0.18160414695739746
],
[
-0.7500413656234741,
-0.49726900458335876,
0.43607503175735474,
0.33032137155532837
],
[
-1.9649572635671575e-08,
0.6593302488327026,
0.7518534660339355,
1.3205885887145996
],
[
0.0,
0.0,
0.0,
1.0
]
],
"extrinsic_cam_object": [
[
-0.6613909006118774,
0.5639212131500244,
-0.4945249855518341,
-0.2212875634431839
],
[
-0.7500413656234741,
-0.49726903438568115,
0.43607503175735474,
0.28531891107559204
],
[
0.0,
0.6593302488327026,
0.7518534660339355,
1.3205885887145996
],
[
0.0,
0.0,
0.0,
1.0
]
],
"intrinsic": [
[
1804.283324707217,
0.0,
640.0
],
[
0.0,
1804.2833964029949,
400.0
],
[
0.0,
0.0,
1.0
]
],
"far_plane": 5.0,
"near_plane": 0.009999999776482582,
"extrinsic_R": [
[
-0.6613909006118774,
0.5639212131500244,
-0.4945249855518341,
-0.2609710693359375
],
[
-0.7500413656234741,
-0.49726900458335876,
0.43607503175735474,
0.2403164505958557
],
[
-1.9649572635671575e-08,
0.6593302488327026,
0.7518534660339355,
1.3205885887145996
],
[
0.0,
0.0,
0.0,
1.0
]
]
}

View File

@ -0,0 +1,99 @@
{
"extrinsic": [
[
-0.1518469899892807,
0.5820408463478088,
-0.7988560199737549,
-0.3575130105018616
],
[
-0.9884040355682373,
-0.08941802382469177,
0.12272702902555466,
0.22206638753414154
],
[
0.0,
0.8082282543182373,
0.5888693332672119,
1.3466811180114746
],
[
0.0,
0.0,
0.0,
1.0
]
],
"extrinsic_cam_object": [
[
-0.1518469899892807,
0.5820408463478088,
-0.7988560199737549,
-0.36662381887435913
],
[
-0.9884040355682373,
-0.08941803127527237,
0.12272702157497406,
0.1627621352672577
],
[
0.0,
0.8082282543182373,
0.5888693332672119,
1.3466811180114746
],
[
0.0,
0.0,
0.0,
1.0
]
],
"intrinsic": [
[
1804.283324707217,
0.0,
640.0
],
[
0.0,
1804.2833964029949,
400.0
],
[
0.0,
0.0,
1.0
]
],
"far_plane": 5.0,
"near_plane": 0.009999999776482582,
"extrinsic_R": [
[
-0.1518469899892807,
0.5820408463478088,
-0.7988560199737549,
-0.3757346272468567
],
[
-0.9884040355682373,
-0.08941802382469177,
0.12272702902555466,
0.10345790535211563
],
[
0.0,
0.8082282543182373,
0.5888693332672119,
1.3466811180114746
],
[
0.0,
0.0,
0.0,
1.0
]
]
}

View File

@ -0,0 +1,99 @@
{
"extrinsic": [
[
-0.2242092788219452,
-0.6652593612670898,
0.7121517062187195,
0.35697290301322937
],
[
0.9745409488677979,
-0.15305395424365997,
0.1638423055410385,
-0.1278637945652008
],
[
0.0,
0.7307559847831726,
0.6826387047767639,
1.4379650354385376
],
[
0.0,
0.0,
0.0,
1.0
]
],
"extrinsic_cam_object": [
[
-0.22420929372310638,
-0.6652594208717346,
0.7121517062187195,
0.34352028369903564
],
[
0.9745410084724426,
-0.15305395424365997,
0.16384229063987732,
-0.06939135491847992
],
[
0.0,
0.7307560443878174,
0.6826387047767639,
1.4379650354385376
],
[
0.0,
0.0,
0.0,
1.0
]
],
"intrinsic": [
[
1804.283324707217,
0.0,
640.0
],
[
0.0,
1804.2833964029949,
400.0
],
[
0.0,
0.0,
1.0
]
],
"far_plane": 5.0,
"near_plane": 0.009999999776482582,
"extrinsic_R": [
[
-0.2242092788219452,
-0.6652593612670898,
0.7121517062187195,
0.33006784319877625
],
[
0.9745409488677979,
-0.15305395424365997,
0.1638423055410385,
-0.010918885469436646
],
[
0.0,
0.7307559847831726,
0.6826387047767639,
1.4379650354385376
],
[
0.0,
0.0,
0.0,
1.0
]
]
}

View File

@ -0,0 +1,99 @@
{
"extrinsic": [
[
-0.9219115376472473,
-0.006451074965298176,
-0.38734668493270874,
-0.06177324056625366
],
[
-0.38740041851997375,
0.015351870097219944,
0.9217837452888489,
0.547621488571167
],
[
-4.655967278388573e-10,
0.9998613595962524,
-0.016652217134833336,
0.9912819266319275
],
[
0.0,
0.0,
0.0,
1.0
]
],
"extrinsic_cam_object": [
[
-0.9219115376472473,
-0.006451074965298176,
-0.38734668493270874,
-0.11708793044090271
],
[
-0.38740041851997375,
0.015351870097219944,
0.9217837452888489,
0.5243774652481079
],
[
0.0,
0.9998613595962524,
-0.016652215272188187,
0.9912818670272827
],
[
0.0,
0.0,
0.0,
1.0
]
],
"intrinsic": [
[
1804.283324707217,
0.0,
640.0
],
[
0.0,
1804.2833964029949,
400.0
],
[
0.0,
0.0,
1.0
]
],
"far_plane": 5.0,
"near_plane": 0.009999999776482582,
"extrinsic_R": [
[
-0.9219115376472473,
-0.006451074965298176,
-0.38734668493270874,
-0.17240260541439056
],
[
-0.38740041851997375,
0.015351870097219944,
0.9217837452888489,
0.5011334419250488
],
[
-4.655967278388573e-10,
0.9998613595962524,
-0.016652217134833336,
0.9912819266319275
],
[
0.0,
0.0,
0.0,
1.0
]
]
}

View File

@ -0,0 +1,99 @@
{
"extrinsic": [
[
0.9554832577705383,
-0.016591109335422516,
0.2945784628391266,
0.14488732814788818
],
[
0.2950453460216522,
0.05372913181781769,
-0.9539713859558105,
-0.6423900127410889
],
[
-1.6758565646313173e-09,
0.9984177350997925,
0.05623241513967514,
1.1682323217391968
],
[
0.0,
0.0,
0.0,
1.0
]
],
"extrinsic_cam_object": [
[
0.9554832577705383,
-0.016591109335422516,
0.2945784628391266,
0.20221629738807678
],
[
0.29504531621932983,
0.05372913181781769,
-0.9539713859558105,
-0.6246873140335083
],
[
0.0,
0.9984177350997925,
0.05623241513967514,
1.1682324409484863
],
[
0.0,
0.0,
0.0,
1.0
]
],
"intrinsic": [
[
1804.283324707217,
0.0,
640.0
],
[
0.0,
1804.2833964029949,
400.0
],
[
0.0,
0.0,
1.0
]
],
"far_plane": 5.0,
"near_plane": 0.009999999776482582,
"extrinsic_R": [
[
0.9554832577705383,
-0.016591109335422516,
0.2945784628391266,
0.25954529643058777
],
[
0.2950453460216522,
0.05372913181781769,
-0.9539713859558105,
-0.6069846153259277
],
[
-1.6758565646313173e-09,
0.9984177350997925,
0.05623241513967514,
1.1682323217391968
],
[
0.0,
0.0,
0.0,
1.0
]
]
}

View File

@ -0,0 +1,99 @@
{
"extrinsic": [
[
-0.12703149020671844,
-0.21042555570602417,
0.969321608543396,
0.44081491231918335
],
[
0.9918986558914185,
-0.026948992162942886,
0.12414005398750305,
-0.07847099751234055
],
[
-1.820248285433479e-09,
0.9772384762763977,
0.21214422583580017,
1.2053426504135132
],
[
0.0,
0.0,
0.0,
1.0
]
],
"extrinsic_cam_object": [
[
-0.12703149020671844,
-0.21042552590370178,
0.9693214893341064,
0.43319305777549744
],
[
0.9918986558914185,
-0.026948990300297737,
0.12414004653692245,
-0.018957069143652916
],
[
0.0,
0.9772383570671082,
0.2121441811323166,
1.2053425312042236
],
[
0.0,
0.0,
0.0,
1.0
]
],
"intrinsic": [
[
1804.283324707217,
0.0,
640.0
],
[
0.0,
1804.2833964029949,
400.0
],
[
0.0,
0.0,
1.0
]
],
"far_plane": 5.0,
"near_plane": 0.009999999776482582,
"extrinsic_R": [
[
-0.12703149020671844,
-0.21042555570602417,
0.969321608543396,
0.42557114362716675
],
[
0.9918986558914185,
-0.026948992162942886,
0.12414005398750305,
0.04055684059858322
],
[
-1.820248285433479e-09,
0.9772384762763977,
0.21214422583580017,
1.2053426504135132
],
[
0.0,
0.0,
0.0,
1.0
]
]
}

View File

@ -0,0 +1,99 @@
{
"extrinsic": [
[
0.9219439029693604,
-0.03747875615954399,
0.3855065107345581,
0.13760963082313538
],
[
0.3873240351676941,
0.08921033143997192,
-0.9176174998283386,
-0.5641251802444458
],
[
6.591580614667691e-09,
0.9953075647354126,
0.09676334261894226,
0.9858072996139526
],
[
0.0,
0.0,
0.0,
1.0
]
],
"extrinsic_cam_object": [
[
0.9219436645507812,
-0.03747875243425369,
0.38550642132759094,
0.19292622804641724
],
[
0.3873239755630493,
0.08921033143997192,
-0.9176173806190491,
-0.5408856272697449
],
[
0.0,
0.995307445526123,
0.09676332026720047,
0.9858072996139526
],
[
0.0,
0.0,
0.0,
1.0
]
],
"intrinsic": [
[
1804.283324707217,
0.0,
640.0
],
[
0.0,
1804.2833964029949,
400.0
],
[
0.0,
0.0,
1.0
]
],
"far_plane": 5.0,
"near_plane": 0.009999999776482582,
"extrinsic_R": [
[
0.9219439029693604,
-0.03747875615954399,
0.3855065107345581,
0.24824289977550507
],
[
0.3873240351676941,
0.08921033143997192,
-0.9176174998283386,
-0.5176461935043335
],
[
6.591580614667691e-09,
0.9953075647354126,
0.09676334261894226,
0.9858072996139526
],
[
0.0,
0.0,
0.0,
1.0
]
]
}

View File

@ -0,0 +1,99 @@
{
"extrinsic": [
[
0.5412637591362,
-0.023032253608107567,
0.8405373692512512,
0.45829901099205017
],
[
0.8408528566360474,
0.014826049096882343,
-0.5410606861114502,
-0.4645334482192993
],
[
0.0,
0.9996247887611389,
0.02739153988659382,
1.0037593841552734
],
[
0.0,
0.0,
0.0,
1.0
]
],
"extrinsic_cam_object": [
[
0.5412637591362,
-0.023032253608107567,
0.8405373692512512,
0.49077484011650085
],
[
0.8408528566360474,
0.014826048165559769,
-0.5410606861114502,
-0.41408228874206543
],
[
0.0,
0.9996247887611389,
0.02739153988659382,
1.0037593841552734
],
[
0.0,
0.0,
0.0,
1.0
]
],
"intrinsic": [
[
1804.283324707217,
0.0,
640.0
],
[
0.0,
1804.2833964029949,
400.0
],
[
0.0,
0.0,
1.0
]
],
"far_plane": 5.0,
"near_plane": 0.009999999776482582,
"extrinsic_R": [
[
0.5412637591362,
-0.023032253608107567,
0.8405373692512512,
0.5232506394386292
],
[
0.8408528566360474,
0.014826049096882343,
-0.5410606861114502,
-0.36363112926483154
],
[
0.0,
0.9996247887611389,
0.02739153988659382,
1.0037593841552734
],
[
0.0,
0.0,
0.0,
1.0
]
]
}

View File

@ -0,0 +1,99 @@
{
"extrinsic": [
[
-0.16835762560367584,
0.9613761901855469,
-0.21774180233478546,
0.019917579367756844
],
[
-0.9857259392738342,
-0.16419877111911774,
0.037189334630966187,
0.08644316345453262
],
[
-6.924856688073078e-09,
0.22089487314224243,
0.9752976298332214,
1.4501163959503174
],
[
0.0,
0.0,
0.0,
1.0
]
],
"extrinsic_cam_object": [
[
-0.16835762560367584,
0.9613761901855469,
-0.21774180233478546,
0.009816107340157032
],
[
-0.985725998878479,
-0.16419878602027893,
0.037189334630966187,
0.027299603447318077
],
[
0.0,
0.22089485824108124,
0.9752976298332214,
1.4501163959503174
],
[
0.0,
0.0,
0.0,
1.0
]
],
"intrinsic": [
[
1804.283324707217,
0.0,
640.0
],
[
0.0,
1804.2833964029949,
400.0
],
[
0.0,
0.0,
1.0
]
],
"far_plane": 5.0,
"near_plane": 0.009999999776482582,
"extrinsic_R": [
[
-0.16835762560367584,
0.9613761901855469,
-0.21774180233478546,
-0.00028533642762340605
],
[
-0.9857259392738342,
-0.16419877111911774,
0.037189334630966187,
-0.03184395655989647
],
[
-6.924856688073078e-09,
0.22089487314224243,
0.9752976298332214,
1.4501163959503174
],
[
0.0,
0.0,
0.0,
1.0
]
]
}

View File

@ -0,0 +1,99 @@
{
"extrinsic": [
[
-0.9821869134902954,
-0.00738184479996562,
-0.18776151537895203,
0.026806922629475594
],
[
-0.18790657818317413,
0.038584865629673004,
0.9814286231994629,
0.5214918851852417
],
[
0.0,
0.9992280006408691,
-0.03928464651107788,
0.9667673707008362
],
[
0.0,
0.0,
0.0,
1.0
]
],
"extrinsic_cam_object": [
[
-0.9821869134902954,
-0.007381844334304333,
-0.18776153028011322,
-0.03212427720427513
],
[
-0.18790657818317413,
0.0385848693549633,
0.9814287424087524,
0.510217547416687
],
[
0.0,
0.9992280602455139,
-0.03928465023636818,
0.9667673707008362
],
[
0.0,
0.0,
0.0,
1.0
]
],
"intrinsic": [
[
1804.283324707217,
0.0,
640.0
],
[
0.0,
1804.2833964029949,
400.0
],
[
0.0,
0.0,
1.0
]
],
"far_plane": 5.0,
"near_plane": 0.009999999776482582,
"extrinsic_R": [
[
-0.9821869134902954,
-0.00738184479996562,
-0.18776151537895203,
-0.0910554975271225
],
[
-0.18790657818317413,
0.038584865629673004,
0.9814286231994629,
0.4989432394504547
],
[
0.0,
0.9992280006408691,
-0.03928464651107788,
0.9667673707008362
],
[
0.0,
0.0,
0.0,
1.0
]
]
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 276 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 323 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 201 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 247 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 178 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 201 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 208 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 284 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 130 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 141 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 216 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 235 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 177 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 208 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 240 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 270 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 177 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 195 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 212 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 276 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 31 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 35 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 33 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 32 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 28 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 28 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 29 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 35 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 36 KiB

Some files were not shown because too many files have changed in this diff Show More