Giter Site home page Giter Site logo

trsvchn / coco-viewer Goto Github PK

View Code? Open in Web Editor NEW
163.0 5.0 51.0 613 KB

Minimalistic COCO Dataset Viewer in Tkinter

License: MIT License

Python 100.00%
coco viewer object-detection bbox masks coco-viewer bounding-boxes computer-vision hacktoberfest

coco-viewer's Introduction

COCO Viewer

Simple COCO Objects Viewer in Tkinter. Allows quick viewing on local machine.

Example images

Keyboard Shortcuts

Key Action
โ†’, J Next Image
โ†, K Previous Image
L, Ctrl + L Toggle Labels
B, Ctrl + B Toggle Boxes
M, Ctrl + M Toggle Masks
Ctrl + S Save Current Image
Ctrl + Q, Ctrl + W Exit Viewer

Requirements

python3 PIL

Installation

git clone https://github.com/trsvchn/coco-viewer.git

Usage

python cocoviewer.py -h

usage: cocoviewer.py [-h] [-i PATH] [-a PATH]

View images with bboxes from the COCO dataset

optional arguments:
  -h, --help                    show this help message and exit
  -i PATH, --images PATH        path to images folder
  -a PATH, --annotations PATH   path to annotations json file

Example:

python cocoviewer.py -i coco/images/val/val2017 -a coco/annotations/val/instances_val2017.json

coco-viewer's People

Contributors

adujardin avatar heada avatar trsvchn avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

coco-viewer's Issues

Error when parsing json file

When trying to run the coco-viewer I get error

INFO: Starting...
INFO: Parsing ../SKU110K_fixed/annotations/val.json...
Traceback (most recent call last):
  File "cocoviewer.py", line 745, in <module>
    main()
  File "cocoviewer.py", line 740, in main
    Controller(data, root, image_panel, statusbar, menu, objects_panel, sliders)
  File "cocoviewer.py", line 477, in __init__
    self.update_img()
  File "cocoviewer.py", line 511, in update_img
    label_size=label_size,
  File "cocoviewer.py", line 90, in compose_current_image
    self.compose_image(self.current_image, **kwargs)
  File "cocoviewer.py", line 78, in compose_image
    draw_masks(draw, objects, names_colors, ignore, alpha)
  File "cocoviewer.py", line 194, in draw_masks
    draw.polygon(m[0], outline=fill, fill=fill)
IndexError: list index out of range

My json file contains only bounding boxes and no masks. Looks like the coco-viewer returns error because there are no polygons defined in json file.

Large image support

Hello, is large image support included? Are we supposed to be able to zoom out images?

Can't have a background annotation

It should be possible to have the first element of a segmentation RLE element to be 0 to be able to label the background but it doesn't seem to be supported. I've tried to insert an arbitrary value in the counts element and reducing the corresponding amount in the next element but it doesn't work either.

It works correctly by appending 0 to the counts element in FiftyOne :

image

KeyError: 'iscrowd'

Hi,
I am getting this error when I run coco-viewer.

(base) chris@Chriss-MacBook-Pro coco-viewer % python cocoviewer.py -i /Users/chris/Documents/video_frames/2022-07-22/Over -a /Users/chris/Downloads/test.json INFO: Starting... INFO: Parsing /Users/chris/Downloads/test.json... Traceback (most recent call last): File "/Users/chris/Documents/coco-viewer/cocoviewer.py", line 821, in <module> main() File "/Users/chris/Documents/coco-viewer/cocoviewer.py", line 816, in main Controller(data, root, image_panel, statusbar, menu, objects_panel, sliders) File "/Users/chris/Documents/coco-viewer/cocoviewer.py", line 514, in __init__ self.update_img() File "/Users/chris/Documents/coco-viewer/cocoviewer.py", line 573, in update_img self.compose_image( File "/Users/chris/Documents/coco-viewer/cocoviewer.py", line 542, in compose_image draw_masks(draw, objects, names_colors, ignore, alpha) File "/Users/chris/Documents/coco-viewer/cocoviewer.py", line 200, in draw_masks elif isinstance(m, dict) and objects[i]["iscrowd"]: KeyError: 'iscrowd' (base) chris@Chriss-MacBook-Pro coco-viewer %

I am just trying out this tool to view my masks. This specific example I'm looking at one image. Since I can't attach json files, I attached a txt file, that I copied and pasted from the json file.
test_json.txt

I'm running this on MacOS Monterey on the M1 chip.

Any help would be greatly appreciated.
Thanks

Add view menu

Currently, app draws a bboxes with masks.

Feature request:

Add a view menu to control the appearance of masks and bounding boxes.

JSON file question

hi @trsvchn, does segmentation element in JSON file needs to be written in RLE format, polygon or it can be just pixel coordinates of my ground truth?

Refactoring the app

I think it is better to have single-file app, since code base is not so HUGE!

Implement statusbar

The idea is to add a simple status bar somewhere on the bottom, to show image name, number of objects, maybe classes, etc

Scrolling for ImageWidget

Add a scrolling for ImageWidget. This can be achieved with the Canvas widget, since Frame or Label is not scrollable.

Set View menu togglers to act globally

Current view menu affects on local image, but it should be a global feature.

Usage idea:

  • use View menu to set up things globally
  • use keyboard to toggle bboxes/masks on current image

Handle RLE masks

Now only polygon masks are supported. We need to handle RLE masks as well.

How to change the loaded image?

I have 100 images. This software can't let me change the image, though it shows 1/100 at the bottom right corner.

Edit: It is possible from keyboard. Left and Right arrow. Do we need better instruction for users like me?

no display name and no $DISPLAY environment variable

Showing the following error:
INFO: Starting... Traceback (most recent call last): File "./coco-viewer/cocoviewer.py", line 898, in <module> main() File "./coco-viewer/cocoviewer.py", line 877, in main root = tk.Tk() File "/usr/lib/python3.7/tkinter/__init__.py", line 2023, in __init__ self.tk = _tkinter.create(screenName, baseName, className, interactive, wantobjects, useTk, sync, use) _tkinter.TclError: no display name and no $DISPLAY environment variable

Migrate to ttk

Let's replace current widgets with ttk widgets. It will help with styling in a future.

Feature request: save file

This is a nice and simple viewer for the coco annotations. It would be nice if there was an option to save the file when looking at them.

Bug to fix in default 'info'

cocoviewer.py
Original, line 542

self.description_status.set(f"{self.data.instances.get('info', '').get('description', '')}")

Should be

self.description_status.set(f"{self.data.instances.get('info', dict()).get('description', '')}")

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.