cvhciKIT / sloth

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

Can't batch add images #90

Closed shiquanwang closed 8 years ago

shiquanwang commented 9 years ago

Click the button Add Image, only can add a single image once. Shift and Ctl for multi selection not working.

baeuml commented 9 years ago

Thanks you are right, this should work.

For now, you can then add more than one image at a time via the command line to your label file:

 sloth appendfiles [options] <labelfile> <file1> [<file2> ...]

for example:

 sloth appendfiles mylabels.json *.jpg
shiquanwang commented 9 years ago

OK. Thanks.

isaacgerg commented 8 years ago

Was this ever fixed?

isaacgerg commented 8 years ago

.jpg doesnt work for me. Looking at the code, I dont see how this could work. I'm assuming .jpg wasnt met to be literal.

nilsonholger commented 8 years ago

@isaacgerg *.jpg relies on shell globbing (to actually extend the regex into all matching file names). So yeah, as far as sloth is concerned, *.jpg is not meant literally.

@shiquanwang There are some patches/commits coming up that will allow to add multiple images at once, stay tuned.

isaacgerg commented 8 years ago

I've made quite a few changes to sloth but have them locally. I didnt know anyone was working on sloth or I wouldve actively contributed them.

On Fri, Jul 29, 2016 at 8:43 PM, nilsonholger notifications@github.com wrote:

@isaacgerg https://github.com/isaacgerg .jpg relies on shell globbing (to actually extend the regex into all matching file names). So yeah, as far as sloth is concerned, .jpg is not meant literally.

@shiquanwang https://github.com/shiquanwang There are some patches/commits coming up that will allow to add multiple images at once, stay tuned.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/cvhciKIT/sloth/issues/90#issuecomment-236326907, or mute the thread https://github.com/notifications/unsubscribe-auth/ALarq2Lff2FEWTBlU9EoZEU7yOVvqeN8ks5qap44gaJpZM4C21Xg .

nilsonholger commented 8 years ago

@isaacgerg Well, I would be really grateful if you took the effort to submit your local changes and possible fixes as pull requests, I promise I will look into them in a timely manner. We are definitely still working with sloth, we've just reached the point where it is mostly doing exactly what we need it to do, so it might seem a bit abandoned from the outside.

isaacgerg commented 8 years ago

I am looking at my changes to sloth I made locally. They are UI enhancements. I am not sure how to do a PR in github. Also, some of the changes are hacks I put in for my data and I don't want to share them.

Below is a summary of my changes:

  1. model.py This should really be elided text. I have long filenames and want to display them easier in the GUI.
@@ -408,7 +408,8 @@
     def data(self, role=Qt.DisplayRole, column=0):
         if role == Qt.DisplayRole:
             if column == 0:
-                return os.path.basename(self['filename'])
+                return self['filename'][-60:]
+                #return os.path.basename(self['filename'])
             elif column == 1 and self.isUnlabeled():
                 return '[unlabeled]'
         return ModelItem.data(self, role, column)
  1. annotationscene.py. Changing the cursor so it has more of an intuitive feel. I use the cross to make the labels, helps me know what mode im in so I can rapidly label images.
@@ -141,12 +141,15 @@
         inserter.inserterFinished.connect(self.onInserterFinished)
         self._labeltool.currentImageChanged.connect(inserter.imageChange)
         self._inserter = inserter
+        
+        # Change cursor to cross
+        self.views()[0].viewport().setCursor(Qt.CrossCursor)
         LOG.debug("Created inserter for class '%s' with default properties '%s'" % (label_class, default_properties))

     def onInsertionModeEnded(self):
         if self._inserter is not None:
             self._inserter.abort()
-
+        self.views()[0].viewport().setCursor(Qt.ArrowCursor)
     #
     # common methods
     #______________________________________________________________________________________________________
  1. gui/framviewer.py. This fix (along with #5) makes the zoom work like windows photo viewer behavior.
@@ -26,6 +26,11 @@
         self._pan = False
         self._panStartX = -1
         self._panStartY = -1
+        
+        # Windows photo viewer like controls
+        self.setRenderHints(QPainter.Antialiasing|QPainter.SmoothPixmapTransform)
+        self.setTransformationAnchor(QGraphicsView.AnchorUnderMouse)
+        self.setDragMode(QGraphicsView.ScrollHandDrag)        

     def fitInView(self):
         if self.scene() is None:
  1. gui/labeltool.py. Again, this text should be elided so it fits nicely in the tool. I do a hack here instead of actually using the elided text lib.
@@ -142,7 +142,7 @@
         if isinstance(new_image, FrameModelItem):
             self.controls.setFrameNumAndTimestamp(new_image.framenum(), new_image.timestamp())
         elif isinstance(new_image, ImageFileModelItem):
-            self.controls.setFilename(os.path.basename(new_image['filename']))
+            self.controls.setFilename(new_image['filename'])

         self.selectionmodel.setCurrentIndex(new_image.index(), QItemSelectionModel.ClearAndSelect|QItemSelectionModel.Rows)
  1. inserters.py. More of my fix for changing the cursur.
@@ -118,7 +118,7 @@
             self.annotationFinished.emit()
             self._init_pos = None
             self._item = None
-
+        self._scene.views()[0].viewport().setCursor(Qt.CrossCursor)
         event.accept()

     def allowOutOfSceneEvents(self):

That's it for now. Will continue to post my fixes.

nilsonholger commented 8 years ago

@isaacgerg to do a Pull Request, you have to fork the sloth repository, clone your fork to your workstation, modify and commit and then you can submit a pull request. Maybe there is an easier way these days through the GitHub webinterface though.

Anyway, thank you for these patches, I will look into them and apply them as I see fit. Also, when I do that now, they will not have your name attached to the commits, but I will try to remember to reference your username in the commit message.

nilsonholger commented 8 years ago

@isaacgerg Created commit e8f7284 from your changes, but did not include the elided text. Thank you for your patches.

As far as this issue goes, it should be fixed with commit 2b49500. Closing this issue now.