cvhciKIT / sloth

Sloth is a tool for labeling image and video data for computer vision research.
Other
608 stars 198 forks source link

SOLVED: NameError: global name 'okv' is not defined / Error loading in Images with .jpg extension #107

Closed RockyCD closed 7 years ago

RockyCD commented 7 years ago

Cannot load .jpg photos over 2MB. Can load large .png with no problems.

Running on a virtual environment on Linux Mint Elizabeth

How would I fix this "okv:

Traceback (most recent call last):
  File "/home/jl/anaconda2/lib/python2.7/site-packages/sloth/gui/labeltool.py", line 398, in addMediaFile
    return self.labeltool.addVideoFile(fname)
  File "/home/jl/anaconda2/lib/python2.7/site-packages/sloth/core/labeltool.py", line 368, in addVideoFile
    video = okv.createVideoSourceFromString(fname)
NameError: global name 'okv' is not defined
372     def addMediaFile(self):
373         path = '.'
374         filename = self.labeltool.getCurrentFilename()
375         if (filename is not None) and (len(filename) > 0):
376             path = QFileInfo(filename).path()
377 
378         image_types = [ '*.jpg', '*.bmp', '*.png', '*.pgm', '*.ppm', '*.ppm', '*.tif', '*.gif' ]
379         video_types = [ '*.mp4', '*.mpg', '*.mpeg', '*.avi', '*.mov', '*.vob' ]
380         format_str = ' '.join(image_types + video_types)
381         fnames = QFileDialog.getOpenFileNames(self, "%s - Add Media File" % APP_NAME, path, "Media files (%s)" % (format_str, ))
382 
383         item = None
384         for fname in fnames:
385             if len(str(fname)) == 0:
386                 continue
387 
388             fname = str(fname)
389 
390             if os.path.isabs(fname):
391                 fname = os.path.relpath(fname, str(path))
392 
393             for pattern in image_types:
394                 if fnmatch.fnmatch(fname, pattern):
395                     item = self.labeltool.addImageFile(fname)
396 
397         if item is None:
398             return self.labeltool.addVideoFile(fname)
399 
400         return item
401 
402     def onViewsLockedChanged(self, checked):
403         features = QDockWidget.AllDockWidgetFeatures
404         if checked:
405             features = QDockWidget.NoDockWidgetFeatures
406 
407         self.ui.dockProperties.setFeatures(features)
408         self.ui.dockAnnotations.setFeatures(features) '
nilsonholger commented 7 years ago

Strange, I just successfully loaded a 4.1MB PNG and generated from that a 6.8MB JPG without any problems, so I cannot reproduce your problem, sorry. Do you have any additional information for me to try and hunt your problem? Maybe your JPG is broken or encoded with a jpg variant not supported by the used libraries...just guessing there...

okv.createVideoSourceFromString(fname) and similar seem to stem from OKAPI (video support), which you most likely don't have, sorry. So there is not much I can do about that.

RockyCD commented 7 years ago

I solved the issue. it is the naming format of the file. It does not like uppercase .PNG or JPG