mryoo / pooled_time_series

PoT java implementation
Apache License 2.0
4 stars 6 forks source link

Indexing Out of Bounds when Saving Vectors #5

Closed MJJoyce closed 8 years ago

MJJoyce commented 9 years ago

Been running into OoB issues when the intermediate result vectors are saved, specifically here. This seems to potentially indicate that the video isn't actually being processed/there's an issue with the processing? Perhaps we could come up with a way to die a bit more gracefully here.

Jul 16, 2015 6:33:50 AM gov.nasa.jpl.memex.pooledtimeseries.PoT main
INFO: Checking file path to ensure that video can be opened ...
Jul 16, 2015 6:33:51 AM gov.nasa.jpl.memex.pooledtimeseries.PoT main
INFO: Added 1 video files from badvideotest/
Jul 16, 2015 6:33:51 AM gov.nasa.jpl.memex.pooledtimeseries.PoT main
INFO: Beginning similarity evaluation...
Jul 16, 2015 6:33:51 AM gov.nasa.jpl.memex.pooledtimeseries.PoT evaluateSimilarity
INFO: 
Processing: badvideotest/test.mp4
Jul 16, 2015 6:33:51 AM gov.nasa.jpl.memex.pooledtimeseries.PoT evaluateSimilarity
INFO: Getting Optical Time Series
Jul 16, 2015 6:33:51 AM gov.nasa.jpl.memex.pooledtimeseries.PoT evaluateSimilarity
INFO: Caching Optical Time Series vectors
Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException: 0
    at gov.nasa.jpl.memex.pooledtimeseries.PoT.saveVectors(PoT.java:487)
    at gov.nasa.jpl.memex.pooledtimeseries.PoT.evaluateSimilarity(PoT.java:221)
    at gov.nasa.jpl.memex.pooledtimeseries.PoT.main(PoT.java:189)
mryoo commented 9 years ago

There are two issues here:

  1. It seems that opencv is unable to open the video. This may be a codec problem or simply that the video does not have any frames in it (i.e., it's an audio not video). Opencv internally takes advantage of ffmpeg to read video files.
  2. Also, the code was not handling empty video files corrected. I fixed it, and now the system will always obtain an empty matrix with getOpticalHistograms() and getGradientHistograms() functions if an empty video file is provided. This will at least allow us to 'run' the code even when the codec is not reading some of the videos.
chrismattmann commented 9 years ago

@mryoo great. Which commit did you fix it in?

mryoo commented 9 years ago

The most recent one? 1144353050023ea13f1ad4d25e34611bf7e1dacc

chrismattmann commented 9 years ago

got it, am going to try and pull this into my fork too

chrismattmann commented 8 years ago

this was addressed in https://github.com/mryoo/pooled_time_series/commit/2a93f025a95801721e36221d9e7e20b213a05852