Skip to content

Commit

Permalink
Modify the ssd/data.py to make it compatible with the mindspore v2.0+…
Browse files Browse the repository at this point in the history
… version.
  • Loading branch information
PingqiLi committed May 24, 2024
1 parent 391d721 commit 9902e29
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion examples/det/ssd/data.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import inspect
import os

import cv2
Expand Down Expand Up @@ -175,14 +176,21 @@ def compose_map_func(img_id, image, annotation):
output_columns = ["img_id", "image", "image_shape"]
trans = [normalize_op, change_swap_op]

# Note: mindspore-2.0 delete the parameter column_order
sig = inspect.signature(ds.map)
pass_column_order = False if "kwargs" in sig.parameters else True

ds = ds.map(
operations=compose_map_func,
input_columns=["img_id", "image", "annotation"],
output_columns=output_columns,
column_order=output_columns,
column_order=output_columns if pass_column_order else None,
python_multiprocessing=python_multiprocessing,
num_parallel_workers=num_parallel_workers,
)
if not pass_column_order:
ds.project(output_columns=output_columns)

ds = ds.map(
operations=trans,
input_columns=["image"],
Expand Down

0 comments on commit 9902e29

Please sign in to comment.