Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

RuntimeError: Failed to interpolate image on first video of sequence #433

Closed
bikeoid opened this issue Aug 12, 2021 · 4 comments
Closed

Comments

@bikeoid
Copy link

bikeoid commented Aug 12, 2021

Basic information

  • Release version: 0.7.4
  • System: Windows subsystem for Linux - Ubuntu 20.04.2 LTS
  • Capture Device: Blackvue DR900S - 2CH

Steps to reproduce behavior

Process with the command

mapillary_tools video_process --import_path "./UplFront"
--verbose
--video_import_path "./Front"
--user_name "usernamehere"
--advanced
--geotag_source "blackvue_videos"
--geotag_source_path "./Front"
--use_gps_start_time
--interpolate_directions
--video_sample_interval 0.2
--device_make "Blackvue"
--device_model "DR900S-2CH"
--overwrite_EXIF_gps_tag

Expected behavior

The first video of a sequence has an anomaly, where the GPS is acquired. It is expected that some frames will not be usable at this time. It is acceptable to discard all frames in that video, or use just the valid frames if possible. Then continue to the next video in the list.

Actual behavior

Script halts and does not process any possible additional valid videos

Extracting video frames: 0%| | 0/2 [00:00<?, ?it/s]Video sampling path set to /mnt/d/mike/Projects/Dashcam/Videos/UplFront/mapillary_sampled_video_frames/20210810_103706_NF
Deriving frame capture time: 100%|████████████████████████████████████████████████| 305/305 [00:00<00:00, 379941.41it/s]
Inserting frame capture time: 305it [00:06, 50.04it/s] | 0/305 [00:00<?, ?it/s]
Extracting video frames: 50%|██████████████████████████████ | 1/2 [00:32<00:32, 32.63s/it]Video sampling path set to /mnt/d/mike/Projects/Dashcam/Videos/UplFront/mapillary_sampled_video_frames/20210810_103807_NF
Deriving frame capture time: 100%|████████████████████████████████████████████████| 305/305 [00:00<00:00, 416020.40it/s]
Inserting frame capture time: 305it [00:06, 46.88it/s] | 0/305 [00:00<?, ?it/s]
Extracting video frames: 100%|████████████████████████████████████████████████████████████| 2/2 [01:07<00:00, 33.58s/it]
Logging: 100%|████████████████████████████████████████████████████████████████████████| 610/610 [00:13<00:00, 43.92it/s]
Sub process ended
Processing image import properties: 100%|█████████████████████████████████████████████| 610/610 [00:14<00:00, 42.04it/s]
Sub process ended
It is assumed that the image timestamps are in UTC. If not, try using the option --local_time.
Inserting gps data into image EXIF: 18%|████████▎ | 55/305 [00:01<00:04, 50.82it/s]
Traceback (most recent call last):
File "/home/allusers/.local/lib/python3.8/site-packages/mapillary_tools/processing.py", line 367, in geotag_from_gps_trace
geotag_properties = get_geotag_properties_from_gps_trace(
File "/home/allusers/.local/lib/python3.8/site-packages/mapillary_tools/processing.py", line 393, in get_geotag_properties_from_gps_trace
lat, lon, bearing, elevation = interpolate_lat_lon(gps_trace, capture_time)
File "/home/allusers/.local/lib/python3.8/site-packages/mapillary_tools/geo.py", line 235, in interpolate_lat_lon
raise MapillaryInterpolationError(
mapillary_tools.geo.MapillaryInterpolationError: Unable to interpolate the point captured at 2021-08-10 14:38:14.011000 because it is beyond the trace end time 2021-08-10 14:38:04.008000 by 10.003 seconds

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
File "/home/allusers/.local/bin/mapillary_tools", line 8, in
sys.exit(main())
File "/home/allusers/.local/lib/python3.8/site-packages/mapillary_tools/main.py", line 93, in main
command.run(args)
File "/home/allusers/.local/lib/python3.8/site-packages/mapillary_tools/commands/video_process.py", line 416, in run
process_geotag_properties(
File "/home/allusers/.local/lib/python3.8/site-packages/mapillary_tools/process_geotag_properties.py", line 94, in process_geotag_properties
processing.geotag_from_blackvue_video(
File "/home/allusers/.local/lib/python3.8/site-packages/mapillary_tools/processing.py", line 274, in geotag_from_blackvue_video
geotag_from_gps_trace(
File "/home/allusers/.local/lib/python3.8/site-packages/mapillary_tools/processing.py", line 371, in geotag_from_gps_trace
raise RuntimeError(
RuntimeError: Failed to interpolate image /mnt/d/mike/Projects/Dashcam/Videos/UplFront/mapillary_sampled_video_frames/20210810_103706_NF/20210810_103706_NF_000056.jpg with the geotag source file ./Front/20210810_103706_NF.gpx. Try the following fixes:

  1. Specify --local_time to read the timestamps from the geotag source file as local time
  2. Use --use_gps_start_time to align the start time
  3. Manually shift the timestamps in the geotag source file with --offset_time OFFSET_IN_SECONDS

Corresponding data

https://www.dropbox.com/s/37rr2hh1r6kg3nc/BlackVueDashcam.zip?dl=1
20210810_103706_NF.mp4 - startup video has GPX anomaly
20210810_103807_NF.mp4 - normal video - this should process if script doesn't abort

Additional information

Older versions did not crash. DR900S still has same camera firmware as before

@ptpt
Copy link
Member

ptpt commented Oct 8, 2021

Hey @bikeoid could you try out the latest mapillary_tools v0.8.0:

mapillary_tools video_process "./Front" "./UplFront"
--verbose
--geotag_source "blackvue_videos"
--interpolate_directions
--video_sample_interval 0.2
--device_make "Blackvue"
--device_model "DR900S-2CH"
--overwrite_EXIF_gps_tag

@bikeoid
Copy link
Author

bikeoid commented Oct 10, 2021

It gave an error here, but now there is a way out:

Traceback (most recent call last):
  File "/home/allusers/.local/bin/mapillary_tools", line 8, in <module>
    sys.exit(main())
  File "/home/allusers/.local/lib/python3.8/site-packages/mapillary_tools/__main__.py", line 123, in main
    args.func(vars(args))
  File "/home/allusers/.local/lib/python3.8/site-packages/mapillary_tools/commands/video_process.py", line 17, in run
    ProcessCommand().run(vars_args)
  File "/home/allusers/.local/lib/python3.8/site-packages/mapillary_tools/commands/process.py", line 251, in run
    insert_MAPJson(
  File "/home/allusers/.local/lib/python3.8/site-packages/mapillary_tools/insert_MAPJson.py", line 135, in insert_MAPJson
    raise RuntimeError(
RuntimeError: Failed to process 934 images. Check ./UplFront/mapillary_image_description.json for details. Specify --skip_process_errors to skip these errors

The final command which worked was:

mapillary_tools video_process "./Front" "./UplFront" \
 --geotag_source "blackvue_videos" \
 --interpolate_directions \
 --video_sample_interval 0.2 \
 --device_make "Blackvue" \
 --device_model "DR900S-2CH" \
 --skip_process_errors \
 --overwrite_EXIF_gps_tag

@ptpt
Copy link
Member

ptpt commented Oct 11, 2021

@bikeoid thanks for trying out the new tools.

The error is by design because users might not expect partial images to be uploaded:

RuntimeError: Failed to process 934 images. Check ./UplFront/mapillary_image_description.json for details. Specify --skip_process_errors to skip these errors

You can check the JSON file ./UplFront/mapillary_image_description.json which files are failed and for what reason. If you want to check processed images before upload, you can convert the file to geojson and paste the content in geojson.io:

python3 -m mapillary_tools.geojson ./UplFront/mapillary_sampled_video_frames/mapillary_image_description.json

@ptpt
Copy link
Member

ptpt commented Jun 28, 2022

Closing because no response. Feel free to reopen if it's still an issue.

@ptpt ptpt closed this as completed Jun 28, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants