Skip to content

Commit bc3adf9

Browse files
committed
Merge branch 'json_enhacement' of https://github.com/superannotateai/superannotate-python-sdk into json_enhacement
2 parents 8db7782 + 665172a commit bc3adf9

File tree

146 files changed

+9973
-4650
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

146 files changed

+9973
-4650
lines changed

superannotate/db/projects.py

Lines changed: 33 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1283,6 +1283,11 @@ def _upload_annotations_from_folder_to_project(
12831283
finish_event.set()
12841284
tqdm_thread.join()
12851285
logger.info("Number of annotations uploaded %s.", sum(num_uploaded))
1286+
if sum(num_uploaded) != len_annotations_paths:
1287+
logger.warning(
1288+
"%s annotations were not uploaded.",
1289+
len_annotations_paths - sum(num_uploaded)
1290+
)
12861291

12871292
for ac_upl in actually_uploaded:
12881293
return_result += [str(p) for p in ac_upl]
@@ -1512,36 +1517,38 @@ def _upload_preannotations_from_folder_to_project(
15121517
annotation_classes_dict = get_annotation_classes_name_to_id(
15131518
annotation_classes
15141519
)
1515-
while True:
1516-
if sum(num_uploaded) == len_preannotations_paths:
1517-
break
1518-
response = _api.send_request(
1519-
req_type='GET',
1520-
path=f'/project/{project_id}/preannotation',
1521-
params=params
1520+
response = _api.send_request(
1521+
req_type='GET',
1522+
path=f'/project/{project_id}/preannotation',
1523+
params=params
1524+
)
1525+
if not response.ok:
1526+
raise SABaseException(response.status_code, response.text)
1527+
aws_creds = response.json()
1528+
1529+
threads = []
1530+
for thread_id in range(_NUM_THREADS):
1531+
t = threading.Thread(
1532+
target=__upload_preannotations_thread,
1533+
args=(
1534+
aws_creds, project_type, preannotations_filenames, folder_path,
1535+
annotation_classes_dict, thread_id, chunksize, num_uploaded,
1536+
already_uploaded, from_s3_bucket
1537+
),
1538+
daemon=True
15221539
)
1523-
if not response.ok:
1524-
raise SABaseException(response.status_code, response.text)
1525-
aws_creds = response.json()
1526-
1527-
threads = []
1528-
for thread_id in range(_NUM_THREADS):
1529-
t = threading.Thread(
1530-
target=__upload_preannotations_thread,
1531-
args=(
1532-
aws_creds, project_type, preannotations_filenames,
1533-
folder_path, annotation_classes_dict, thread_id, chunksize,
1534-
num_uploaded, already_uploaded, from_s3_bucket
1535-
),
1536-
daemon=True
1537-
)
1538-
threads.append(t)
1539-
t.start()
1540-
for t in threads:
1541-
t.join()
1540+
threads.append(t)
1541+
t.start()
1542+
for t in threads:
1543+
t.join()
15421544
finish_event.set()
15431545
tqdm_thread.join()
15441546
logger.info("Number of preannotations uploaded %s.", sum(num_uploaded))
1547+
if sum(num_uploaded) != len_preannotations_paths:
1548+
logger.warning(
1549+
"%s preannotations were not uploaded.",
1550+
len_preannotations_paths - sum(num_uploaded)
1551+
)
15451552
return return_result + [str(p) for p in preannotations_paths]
15461553

15471554

Lines changed: 30 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,30 @@
1-
[
2-
{
3-
"classId": 1454,
4-
"probability": 100,
5-
"visible": true,
6-
"attributes": [],
7-
"parts": [
8-
{
9-
"color": "#00000f"
10-
}
11-
],
12-
"className": "Cat"
13-
}
14-
]
1+
{
2+
"metadata": {
3+
"name": "cat1.jpg",
4+
"width": null,
5+
"height": null,
6+
"status": null,
7+
"pinned": null,
8+
"isPredicted": null,
9+
"projectId": null,
10+
"annotatorEmail": null,
11+
"qaEmail": null,
12+
"isSegmented": null
13+
},
14+
"instances": [
15+
{
16+
"classId": 1454,
17+
"probability": 100,
18+
"visible": true,
19+
"attributes": [],
20+
"parts": [
21+
{
22+
"color": "#00000f"
23+
}
24+
],
25+
"className": "Cat"
26+
}
27+
],
28+
"tags": [],
29+
"comments": []
30+
}
Lines changed: 30 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,30 @@
1-
[
2-
{
3-
"classId": 1454,
4-
"probability": 100,
5-
"visible": true,
6-
"attributes": [],
7-
"parts": [
8-
{
9-
"color": "#00000f"
10-
}
11-
],
12-
"className": "Cat"
13-
}
14-
]
1+
{
2+
"metadata": {
3+
"name": "cat2.jpg",
4+
"width": null,
5+
"height": null,
6+
"status": null,
7+
"pinned": null,
8+
"isPredicted": null,
9+
"projectId": null,
10+
"annotatorEmail": null,
11+
"qaEmail": null,
12+
"isSegmented": null
13+
},
14+
"instances": [
15+
{
16+
"classId": 1454,
17+
"probability": 100,
18+
"visible": true,
19+
"attributes": [],
20+
"parts": [
21+
{
22+
"color": "#00000f"
23+
}
24+
],
25+
"className": "Cat"
26+
}
27+
],
28+
"tags": [],
29+
"comments": []
30+
}
Lines changed: 30 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,30 @@
1-
[
2-
{
3-
"classId": 1454,
4-
"probability": 100,
5-
"visible": true,
6-
"attributes": [],
7-
"parts": [
8-
{
9-
"color": "#00000f"
10-
}
11-
],
12-
"className": "Cat"
13-
}
14-
]
1+
{
2+
"metadata": {
3+
"name": "cat3.jpg",
4+
"width": null,
5+
"height": null,
6+
"status": null,
7+
"pinned": null,
8+
"isPredicted": null,
9+
"projectId": null,
10+
"annotatorEmail": null,
11+
"qaEmail": null,
12+
"isSegmented": null
13+
},
14+
"instances": [
15+
{
16+
"classId": 1454,
17+
"probability": 100,
18+
"visible": true,
19+
"attributes": [],
20+
"parts": [
21+
{
22+
"color": "#00000f"
23+
}
24+
],
25+
"className": "Cat"
26+
}
27+
],
28+
"tags": [],
29+
"comments": []
30+
}
Lines changed: 30 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,30 @@
1-
[
2-
{
3-
"classId": 1455,
4-
"probability": 100,
5-
"visible": true,
6-
"attributes": [],
7-
"parts": [
8-
{
9-
"color": "#00000f"
10-
}
11-
],
12-
"className": "Dog"
13-
}
14-
]
1+
{
2+
"metadata": {
3+
"name": "cat4.jpeg",
4+
"width": null,
5+
"height": null,
6+
"status": null,
7+
"pinned": null,
8+
"isPredicted": null,
9+
"projectId": null,
10+
"annotatorEmail": null,
11+
"qaEmail": null,
12+
"isSegmented": null
13+
},
14+
"instances": [
15+
{
16+
"classId": 1455,
17+
"probability": 100,
18+
"visible": true,
19+
"attributes": [],
20+
"parts": [
21+
{
22+
"color": "#00000f"
23+
}
24+
],
25+
"className": "Dog"
26+
}
27+
],
28+
"tags": [],
29+
"comments": []
30+
}
Lines changed: 30 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,30 @@
1-
[
2-
{
3-
"classId": 1454,
4-
"probability": 100,
5-
"visible": true,
6-
"attributes": [],
7-
"parts": [
8-
{
9-
"color": "#00001e"
10-
}
11-
],
12-
"className": "Cat"
13-
}
14-
]
1+
{
2+
"metadata": {
3+
"name": "cat5.jpg",
4+
"width": null,
5+
"height": null,
6+
"status": null,
7+
"pinned": null,
8+
"isPredicted": null,
9+
"projectId": null,
10+
"annotatorEmail": null,
11+
"qaEmail": null,
12+
"isSegmented": null
13+
},
14+
"instances": [
15+
{
16+
"classId": 1454,
17+
"probability": 100,
18+
"visible": true,
19+
"attributes": [],
20+
"parts": [
21+
{
22+
"color": "#00001e"
23+
}
24+
],
25+
"className": "Cat"
26+
}
27+
],
28+
"tags": [],
29+
"comments": []
30+
}
Lines changed: 30 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,30 @@
1-
[
2-
{
3-
"classId": 1455,
4-
"probability": 100,
5-
"visible": true,
6-
"attributes": [],
7-
"parts": [
8-
{
9-
"color": "#00001e"
10-
}
11-
],
12-
"className": "Dog"
13-
}
14-
]
1+
{
2+
"metadata": {
3+
"name": "dog1.jpg",
4+
"width": null,
5+
"height": null,
6+
"status": null,
7+
"pinned": null,
8+
"isPredicted": null,
9+
"projectId": null,
10+
"annotatorEmail": null,
11+
"qaEmail": null,
12+
"isSegmented": null
13+
},
14+
"instances": [
15+
{
16+
"classId": 1455,
17+
"probability": 100,
18+
"visible": true,
19+
"attributes": [],
20+
"parts": [
21+
{
22+
"color": "#00001e"
23+
}
24+
],
25+
"className": "Dog"
26+
}
27+
],
28+
"tags": [],
29+
"comments": []
30+
}

0 commit comments

Comments
 (0)