Skip to content

Commit

Permalink
Make ssd data module compatible with mindspore v2.0+ version (#778)
Browse files Browse the repository at this point in the history
* fix the config of squeezenet_1.0 with amp_level O0

* Modify the ssd/data.py to make it compatible with the mindspore v2.0+ version.
  • Loading branch information
PingqiLi authored May 25, 2024
1 parent 21642c3 commit 517fa99
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 517fa99

Please sign in to comment.