-
-
Notifications
You must be signed in to change notification settings - Fork 3.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
49 additions
and
2 deletions.
There are no files selected for viewing
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,6 @@ | ||
# flake8: noqa | ||
|
||
from . import draw_json | ||
from . import draw_label_png | ||
from . import json_to_dataset | ||
from . import on_docker |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
import argparse | ||
import logging | ||
|
||
import matplotlib.pyplot as plt | ||
import numpy as np | ||
import PIL.Image | ||
|
||
from labelme import utils | ||
|
||
|
||
def main(): | ||
logger = logging.Logger('labelme') | ||
logger.setLevel(logging.INFO) | ||
|
||
parser = argparse.ArgumentParser( | ||
formatter_class=argparse.ArgumentDefaultsHelpFormatter) | ||
parser.add_argument('label_png', help='label PNG file') | ||
args = parser.parse_args() | ||
|
||
lbl = np.asarray(PIL.Image.open(args.label_png)) | ||
if lbl.dtype != np.int32: | ||
logger.warn('We recomment numpy.int32 for the label, but it has: {}' | ||
.format(lbl.dtype)) | ||
|
||
logger.info('label shape: {}'.format(lbl.shape)) | ||
logger.info('unique label values: {}'.format(np.unique(lbl))) | ||
|
||
lbl_viz = utils.draw_label(lbl) | ||
plt.imshow(lbl_viz) | ||
plt.show() | ||
|
||
|
||
if __name__ == '__main__': | ||
main() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters