Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
QtCore.QLocale.system().name(),
osp.dirname(osp.abspath(__file__)) + '/translate'
)
app = QtWidgets.QApplication(sys.argv)
app.setApplicationName(__appname__)
app.setWindowIcon(newIcon('icon'))
app.installTranslator(translator)
win = MainWindow(
config=config,
filename=filename,
output_file=output_file,
output_dir=output_dir,
)
if reset_config:
logger.info('Resetting Qt config: %s' % win.settings.fileName())
win.settings.clear()
sys.exit(0)
win.show()
win.raise_()
sys.exit(app.exec_())
def main():
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))
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()
def main():
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))
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()
)
PIL.Image.fromarray(img).save(osp.join(out_dir, 'img.png'))
utils.lblsave(osp.join(out_dir, 'label.png'), lbl)
PIL.Image.fromarray(lbl_viz).save(osp.join(out_dir, 'label_viz.png'))
with open(osp.join(out_dir, 'label_names.txt'), 'w') as f:
for lbl_name in label_names:
f.write(lbl_name + '\n')
logger.warning('info.yaml is being replaced by label_names.txt')
info = dict(label_names=label_names)
with open(osp.join(out_dir, 'info.yaml'), 'w') as f:
yaml.safe_dump(info, f, default_flow_style=False)
logger.info('Saved to: {}'.format(out_dir))
def deleteFile(self):
mb = QtWidgets.QMessageBox
msg = self.tr('You are about to permanently delete this label file, '
'proceed anyway?')
answer = mb.warning(self, self.tr('Attention'), msg, mb.Yes | mb.No)
if answer != mb.Yes:
return
label_file = self.getLabelFile()
if osp.exists(label_file):
os.remove(label_file)
logger.info('Label file is removed: {}'.format(label_file))
item = self.fileListWidget.currentItem()
item.setCheckState(Qt.Unchecked)
self.resetState()