limap.line2d.SOLD2 package
Subpackages
- limap.line2d.SOLD2.misc package
- limap.line2d.SOLD2.model package
- Subpackages
- Submodules
- limap.line2d.SOLD2.model.line_detection module
LineSegmentDetectionModule
LineSegmentDetectionModule.candidate_suppression()
LineSegmentDetectionModule.convert_inputs()
LineSegmentDetectionModule.detect()
LineSegmentDetectionModule.detect_bilinear()
LineSegmentDetectionModule.detect_local_max()
LineSegmentDetectionModule.refine_heatmap()
LineSegmentDetectionModule.refine_heatmap_local()
LineSegmentDetectionModule.refine_junction_perturb()
LineSegmentDetectionModule.segments_to_line_map()
- limap.line2d.SOLD2.model.line_detector module
- limap.line2d.SOLD2.model.line_matcher module
- limap.line2d.SOLD2.model.line_matching module
WunschLineMatcher
WunschLineMatcher.asl_feat_saliency_score()
WunschLineMatcher.compute_descriptors()
WunschLineMatcher.compute_matches()
WunschLineMatcher.compute_matches_topk()
WunschLineMatcher.compute_matches_topk_gpu()
WunschLineMatcher.d2_net_saliency_score()
WunschLineMatcher.filter_and_match_lines()
WunschLineMatcher.filter_and_match_lines_topk()
WunschLineMatcher.filter_and_match_lines_topk_gpu()
WunschLineMatcher.forward()
WunschLineMatcher.get_pairwise_distance()
WunschLineMatcher.needleman_wunsch()
WunschLineMatcher.sample_line_points()
WunschLineMatcher.sample_salient_points()
- limap.line2d.SOLD2.model.loss module
- limap.line2d.SOLD2.model.lr_scheduler module
- limap.line2d.SOLD2.model.metrics module
- limap.line2d.SOLD2.model.model_util module
- Module contents
Submodules
limap.line2d.SOLD2.experiment module
Main file to launch training and testing experiments.
- limap.line2d.SOLD2.experiment.load_config(config_path)
Load configurations from a given yaml file.
- limap.line2d.SOLD2.experiment.record_config(model_cfg, dataset_cfg, output_path)
Record dataset config to the log path.
- limap.line2d.SOLD2.experiment.update_config(path, model_cfg=None, dataset_cfg=None)
Update configuration file from the resume path.
limap.line2d.SOLD2.sold2 module
- class limap.line2d.SOLD2.sold2.SOLD2Detector(options=BaseDetectorOptions(set_gray=True, max_num_2d_segs=3000, do_merge_lines=False, visualize=False, weight_path=None))
Bases:
BaseDetector
- detect(camview)
Virtual method (for detector) - detect 2D line segments
- Parameters:
view (
limap.base.CameraView
) – The limap.base.CameraView instance corresponding to the image- Returns:
line detections. Each row corresponds to x1, y1, x2, y2 and score.
- Return type:
np.array
of shape (N, 5)
- detect_and_extract(camview)
Virtual method (for dual-functional class that can perform both detection and extraction) - Detect and extract on a single image
- Parameters:
view (
limap.base.CameraView
) – The limap.base.CameraView instance corresponding to the image- Returns:
of shape (N, 5), line detections. Each row corresponds to x1, y1, x2, y2 and score. Computed from the detect method. descinfo: The features extracted from the function extract
- Return type:
segs (
np.array
)
- extract(camview, segs)
Virtual method (for extractor) - extract the features for the detected segments
- Parameters:
view (
limap.base.CameraView
) – The limap.base.CameraView instance corresponding to the imagesegs –
np.array
of shape (N, 5), line detections. Each row corresponds to x1, y1, x2, y2 and score. Computed from the detect method.
- Returns:
The extracted feature
- extract_heatmap(camview)
- extract_heatmaps_all_images(folder, imagecols, skip_exists=False)
- get_descinfo_fname(descinfo_folder, img_id)
Virtual method (for extractor) - Get the target filename of the extracted feature
- Parameters:
descinfo_folder (str) – The output folder
img_id (int) – The image id
- Returns:
target filename
- Return type:
str
- get_heatmap_fname(folder, img_id)
- get_module_name()
Virtual method (need to be implemented) - return the name of the module
- read_descinfo(descinfo_folder, img_id)
Virtual method (for extractor) - Read in the extracted feature. Dual function for save_descinfo.
- Parameters:
descinfo_folder (str) – The output folder
img_id (int) – The image id
- Returns:
The extracted feature
- sample_descinfo_by_indexes(descinfo, indexes)
Virtual method (for dual-functional class that can perform both detection and extraction) - sample descriptors for a subset of images
- Parameters:
descinfo – The features extracted from the function extract.
indexes (list[int]) – List of image ids for the subset.
- save_descinfo(descinfo_folder, img_id, descinfo)
Virtual method (for extractor) - Save the extracted feature to the target folder
- Parameters:
descinfo_folder (str) – The output folder
img_id (int) – The image id
descinfo – The features extracted from the function extract
limap.line2d.SOLD2.sold2_wrapper module
- class limap.line2d.SOLD2.sold2_wrapper.SOLD2LineDetector(device=None, cfg_path=None, weight_path=None)
Bases:
object
- compute_descinfo(segs, desc)
- detect(input_image, saliency=False, scale_factor=None)
- get_heatmap(input_image)
- initialize_line_matcher()
- match(img1, img2)
- match_segs_with_descinfo(descinfo1, descinfo2)
- match_segs_with_descinfo_topk(descinfo1, descinfo2, topk=10)
- match_segs_with_descriptor(segs1, desc1, segs2, desc2)
- segstosold2segs(segs)
- sold2segstosegs(segs_sold2)
limap.line2d.SOLD2.train module
This file implements the training process and all the summaries
- limap.line2d.SOLD2.train.convert_junc_predictions(predictions, grid_size, detect_thresh=0.015384615384615385, topk=300)
Convert torch predictions to numpy arrays for evaluation.
- limap.line2d.SOLD2.train.customized_collate_fn(batch)
Customized collate_fn.
- limap.line2d.SOLD2.train.plot_junction_detection(image_tensor, junc_pred_tensor, junc_pred_nms_tensor, junc_gt_tensor)
Plot the junction points on images.
- limap.line2d.SOLD2.train.record_test_summaries(writer, epoch, scalars)
Record testing summaries.
- limap.line2d.SOLD2.train.record_train_summaries(writer, global_step, scalars, images)
Record training summaries.
- limap.line2d.SOLD2.train.restore_weights(model, state_dict, strict=True)
Restore weights in compatible mode.
- limap.line2d.SOLD2.train.train_single_epoch(model, model_cfg, optimizer, loss_func, metric_func, train_loader, writer, epoch)
Train for one epoch.
- limap.line2d.SOLD2.train.validate(model, model_cfg, loss_func, metric_func, val_loader, writer, epoch)
Validation.