Skip to content

Commit 2c6df3d

Browse files
committed
Merge branch 'master' of https://github.com/superannotateai/superannotate-python-sdk into public_links_dev
2 parents 2c6a946 + 41f81a0 commit 2c6df3d

File tree

4 files changed

+20
-12
lines changed

4 files changed

+20
-12
lines changed

docs/source/conf.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020

2121
project = 'SuperAnnotate Python SDK'
2222
copyright = '2021, SuperAnnotate AI'
23-
author = 'Hovnatan Karapetyan, Vahagn Tumanyan, Armen Gyurjinyan, Shabin Dilanchian, Erik Harutyunyan, Arsine Mangasaryan'
23+
author = 'SuperAnnotate AI'
2424

2525
# The full version, including alpha/beta/rc tags
2626
release = superannotate.__version__

superannotate/input_converters/converters/coco_converters/coco_to_sa_pixel.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ def coco_panoptic_segmentation_to_sa_pixel(coco_path, output_dir):
6060
annot_name = Path(annot["file_name"]).stem
6161
img_cv = cv2.imread(str(output_dir / ("%s.png" % annot_name)))
6262
if img_cv is None:
63-
images_not_converted.append("%s.jpg" % annot_name)
63+
images_not_converted.append(annot['file_name'])
6464
logger.warning(
6565
"'%s' file dosen't exist!",
6666
output_dir / ("%s.png" % annot_name)
@@ -84,10 +84,12 @@ def coco_panoptic_segmentation_to_sa_pixel(coco_path, output_dir):
8484
sa_instances.append(sa_obj)
8585

8686
img = cv2.cvtColor(img.reshape((H, W, C)), cv2.COLOR_RGB2BGR)
87-
cv2.imwrite(str(output_dir / ("%s.jpg___save.png" % annot_name)), img)
87+
cv2.imwrite(
88+
str(output_dir / ("%s___save.png" % annot['file_name'])), img
89+
)
8890

89-
images_converted.append("%s.jpg" % annot_name)
90-
file_name = "%s.jpg___pixel.json" % annot_name
91+
images_converted.append(annot['file_name'])
92+
file_name = "%s___pixel.json" % annot['file_name']
9193
sa_metadata = {
9294
'name': annot_name,
9395
'width': img_id_to_shape[str(annot['image_id'])]['width'],

superannotate/input_converters/export_from_sa_conversions.py

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
logger = logging.getLogger("superannotate-python-sdk")
1717

1818

19-
def _load_files(path_to_imgs, ptype):
19+
def _load_files(path_to_imgs, task, ptype):
2020
suffix = None
2121
if ptype == "Pixel":
2222
suffix = '___pixel.json'
@@ -27,16 +27,21 @@ def _load_files(path_to_imgs, ptype):
2727
orig_images = [str(x).replace(suffix, '') for x in orig_images]
2828
all_files = None
2929

30-
if ptype == 'Pixel':
30+
if task == 'keypoint_detection':
31+
all_files = np.array([[fname, fname + suffix] for fname in orig_images])
32+
elif ptype == 'Pixel':
3133
all_files = np.array(
3234
[
33-
(str(fname), str(fname) + suffix, str(fname) + '___save.png')
35+
[fname, fname + suffix, fname + '___save.png']
3436
for fname in orig_images
3537
]
3638
)
3739
elif ptype == 'Vector':
3840
all_files = np.array(
39-
[(str(fname), str(fname) + suffix) for fname in orig_images]
41+
[
42+
[fname, fname + suffix, fname + '___fuse.png']
43+
for fname in orig_images
44+
]
4045
)
4146

4247
return all_files
@@ -47,7 +52,8 @@ def _move_files(data_set, src):
4752
if data_set is not None:
4853
for tup in data_set:
4954
for i in tup:
50-
shutil.copy(i, train_path / Path(i).name)
55+
if Path(i).exists():
56+
shutil.copy(i, train_path / Path(i).name)
5157
else:
5258
logger.warning("Images doesn't exist")
5359

@@ -78,7 +84,7 @@ def export_from_sa(args):
7884
except Exception as e:
7985
_create_classes_mapper(args.input_dir, args.output_dir)
8086

81-
data_set = _load_files(args.input_dir, args.project_type)
87+
data_set = _load_files(args.input_dir, args.task, args.project_type)
8288
_move_files(data_set, args.output_dir)
8389

8490
args.__dict__.update(

superannotate/version.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
__version__ = "4.1.0b18"
1+
__version__ = "4.1.0"

0 commit comments

Comments
 (0)