in code/cpp/tools/scene_annotation_tool/main.cpp [324:425]
void initialize_tool_state() {
g_rtc_scene = nullptr;
g_rng = std::mt19937(0);
g_semantic_instance_descs = {};
g_semantic_instance_counter = 0;
g_semantic_instance_id = create_new_semantic_instance_segmentation_id();
g_updated_semantic_instance_id = true;
//
// load semantic labels from csv file
//
// NYU40 labels can be obtained here:
// https://github.com/shelhamer/fcn.berkeleyvision.org/blob/master/data/nyud/classes.txt
// https://github.com/ScanNet/ScanNet/blob/master/BenchmarkScripts/util.py
//
// cityscapes labels can be obtained here:
// https://github.com/mcordts/cityscapesScripts/blob/master/cityscapesscripts/helpers/labels.py
//
assert(filesystem_exists(g_cmd_semantic_descs_csv_file));
std::ifstream fs(g_cmd_semantic_descs_csv_file);
std::string line;
std::getline(fs, line); // get csv header
assert(fs);
while (std::getline(fs, line)) {
std::istringstream ss(line);
std::string token;
std::getline(ss, token, ','); assert(ss); auto semantic_id = std::stoi(token);
std::getline(ss, token, ','); assert(ss); auto semantic_name = string_trim(token);
std::getline(ss, token, ','); assert(ss); auto semantic_color_r = std::stoi(token);
std::getline(ss, token, ','); assert(ss); auto semantic_color_g = std::stoi(token);
std::getline(ss, token, ','); assert(ss); auto semantic_color_b = std::stoi(token);
if (semantic_id <= 0) {
std::cout << "[HYPERSIM: SCENE_ANNOTATION_TOOL] ERROR: SEMANTIC LABEL IDs -1 AND 0 ARE RESERVED FOR INTERNAL USE, AND ARE NOT ALLOWED IN " << g_cmd_semantic_descs_csv_file << "..." << std::endl;
assert(false);
}
std::cout << "[HYPERSIM: SCENE_ANNOTATION_TOOL] Adding semantic label: " << semantic_id << ", " << semantic_name << ", " << semantic_color_r << ", " << semantic_color_g << ", " << semantic_color_b << std::endl;
g_semantic_descs.insert({semantic_id, {semantic_name, {semantic_color_r,semantic_color_g,semantic_color_b}}});
}
if (g_semantic_descs.size() == 0) {
std::cout << "[HYPERSIM: SCENE_ANNOTATION_TOOL] ERROR: " << g_cmd_semantic_descs_csv_file << " MUST CONTAIN AT LEAST ONE ENTRY..." << std::endl;
assert(false);
}
g_semantic_id = 1;
g_mouse_rotation = false;
g_mouse_translation = false;
g_mouse_drawing = false;
g_mouse_drawing_create = false;
g_mouse_drawing_key_modifier = false;
g_mouse_curr_x = 0;
g_mouse_curr_y = 0;
g_mouse_prev_x = 0;
g_mouse_prev_y = 0;
g_mouse_ignore_counter = 0;
g_mouse_drawing_positions = std::vector<arma::ivec>();
g_scene_loaded = false;
g_scene_dir = "";
g_tool = TOOL_RECTANGLE;
g_erase_mode = false;
g_assign_unique_semantic_instance_ids_to_each_mesh_object = false;
g_can_undo = false;
g_can_redo = false;
g_segmentation_layer = SEGMENTATION_LAYER_SEMANTIC;
g_prefer_select_faces_by_mode = PREFER_SELECT_FACES_BY_MODE_OBJECT_MESH_ID;
g_select_only_null_semantic_instance_id = true;
g_select_only_valid_semantic_instance_id = false;
g_select_only_null_semantic_id = true;
g_select_only_valid_semantic_id = false;
g_updated_collapse_state_segmentation = true;
g_navigation_sensitivity = 1.0f;
g_max_num_vertices = 15000000;
g_max_num_faces = 1500000;
g_face_score_area_half_life = 1.0f;
g_face_score_distance_half_life = 50.0f;
g_prefer_remove_small_vertices = true;
g_prefer_remove_distant_vertices = false;
g_remove_orphaned_vertices = true;
g_viewer.core().camera_view_angle = 60.0;
g_viewer.core().camera_dnear = 1.0;
g_viewer.core().camera_dfar = 10000.0;
g_viewer.data().show_lines = false;
}