Support of context images for 2D tasks (Missed commits) (#3213)

* Fixed bug with not filtering file itself in some 3D cases

* Added else branch to avoid dublication context images in some cases
main
Boris Sekachev 5 years ago committed by GitHub
parent 6f52ef30e4
commit e0f10d7b7f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -125,20 +125,23 @@ def _detect_related_images_3D(image_paths, root_path):
# Update some data applicable for a subset of paths (within the current dirname)
latest_dirname = dirname
related_images_exist = os.path.isdir(related_images_dirname)
dirname_files = list(filter(lambda x: x != image_path, _list_and_join(dirname)))
dirname_files = list(_list_and_join(dirname))
velodyne_context_images_dirs = [directory for directory
in _list_and_join(os.path.normpath(os.path.join(dirname, '..', '..')))
if os.path.isdir(os.path.join(directory, 'data')) and re.search(r'image_\d.*', directory, re.IGNORECASE)
]
if os.path.basename(dirname) == name:
filtered_dirname_files = list(filter(lambda x: x != image_path, dirname_files))
if len(filtered_dirname_files) and os.path.basename(dirname) == name:
# default format (option 2)
related_images[rel_image_path].extend(_prepare_context_list(dirname_files, root_path))
filtered_dirname_files = list(filter(lambda x: os.path.splitext(os.path.basename(x))[0] == name, dirname_files))
if len(filtered_dirname_files):
# default format (option 1)
related_images[rel_image_path].extend(_prepare_context_list(filtered_dirname_files, root_path))
else:
filtered_dirname_files = list(
filter(lambda x: os.path.splitext(os.path.basename(x))[0] == name, filtered_dirname_files)
)
if len(filtered_dirname_files):
# default format (option 1)
related_images[rel_image_path].extend(_prepare_context_list(filtered_dirname_files, root_path))
if related_images_exist:
related_images_dirname = os.path.join(

Loading…
Cancel
Save