Skip to content

Commit

Permalink
fix build error after cherry-pick
Browse files Browse the repository at this point in the history
  • Loading branch information
lvhan028 committed Dec 5, 2022
1 parent 49d8825 commit b2c16d3
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 24 deletions.
19 changes: 9 additions & 10 deletions csrc/mmdeploy/codebase/mmocr/rescale_to_height.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -112,18 +112,14 @@ class RescaleToHeightImpl : public Module {
Stream stream_;
};

class RescaleToHeightImplCreator : public Creator<RescaleToHeightImpl> {
public:
const char* GetName() const override { return "cpu"; }
int GetVersion() const override { return 1; }
ReturnType Create(const Value& args) override {
return std::make_unique<RescaleToHeightImpl>(args);
}
};
MMDEPLOY_CREATOR_SIGNATURE(RescaleToHeightImpl,
std::unique_ptr<RescaleToHeightImpl>(const Value& config));

MMDEPLOY_DEFINE_REGISTRY(RescaleToHeightImpl);

REGISTER_MODULE(RescaleToHeightImpl, RescaleToHeightImplCreator);
MMDEPLOY_REGISTER_FACTORY_FUNC(RescaleToHeightImpl, (cpu, 0), [](const Value& config) {
return std::make_unique<RescaleToHeightImpl>(config);
});

class RescaleToHeight : public Transform {
public:
Expand All @@ -139,5 +135,8 @@ class RescaleToHeight : public Transform {
static const std::string name_;
};

DECLARE_AND_REGISTER_MODULE(Transform, RescaleToHeight, 1);
MMDEPLOY_REGISTER_FACTORY_FUNC(Transform, (ResizeOCR, 0), [](const Value& config) {
return std::make_unique<RescaleToHeight>(config);
});

} // namespace mmdeploy
26 changes: 13 additions & 13 deletions csrc/mmdeploy/codebase/mmocr/short_scale_aspect_jitter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,14 +27,16 @@ class ShortScaleAspectJitterImpl : public Module {
ratio_range_[0] = args["ratio_range"][0].get<float>();
ratio_range_[1] = args["ratio_range"][1].get<float>();
} else {
throw std::invalid_argument("'ratio_range' should be a float array of size 2");
MMDEPLOY_ERROR("'ratio_range' should be a float array of size 2");
throw_exception(eInvalidArgument);
}

if (args["aspect_ratio_range"].is_array() && args["aspect_ratio_range"].size() == 2) {
aspect_ratio_range_[0] = args["aspect_ratio_range"][0].get<float>();
aspect_ratio_range_[1] = args["aspect_ratio_range"][1].get<float>();
} else {
throw std::invalid_argument("'aspect_ratio_range' should be a float array of size 2");
MMDEPLOY_ERROR("'aspect_ratio_range' should be a float array of size 2");
throw_exception(eInvalidArgument);
}
scale_divisor_ = args.contains("scale_divisor") && args["scale_divisor"].is_number_integer()
? args["scale_divisor"].get<int>()
Expand Down Expand Up @@ -120,18 +122,13 @@ class ShortScaleAspectJitterImpl : public Module {
Stream stream_;
};

class ShortScaleAspectJitterImplCreator : public Creator<ShortScaleAspectJitterImpl> {
public:
const char* GetName() const override { return "cpu"; }
int GetVersion() const override { return 1; }
ReturnType Create(const Value& args) override {
return std::make_unique<ShortScaleAspectJitterImpl>(args);
}
};

MMDEPLOY_CREATOR_SIGNATURE(ShortScaleAspectJitterImpl,
std::unique_ptr<ShortScaleAspectJitterImpl>(const Value& config));
MMDEPLOY_DEFINE_REGISTRY(ShortScaleAspectJitterImpl);

REGISTER_MODULE(ShortScaleAspectJitterImpl, ShortScaleAspectJitterImplCreator);
MMDEPLOY_REGISTER_FACTORY_FUNC(ShortScaleAspectJitterImpl, (cpu, 0), [](const Value& config) {
return std::make_unique<ShortScaleAspectJitterImpl>(config);
});

class ShortScaleAspectJitter : public Transform {
public:
Expand All @@ -147,5 +144,8 @@ class ShortScaleAspectJitter : public Transform {
static const std::string name_;
};

DECLARE_AND_REGISTER_MODULE(Transform, ShortScaleAspectJitter, 1);
MMDEPLOY_REGISTER_FACTORY_FUNC(Transform, (ShortScaleAspectJitter, 0), [](const Value& config) {
return std::make_unique<ShortScaleAspectJitter>(config);
});

} // namespace mmdeploy
2 changes: 1 addition & 1 deletion csrc/mmdeploy/codebase/mmpose/simcc_label.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,6 @@ class SimCCLabelDecode : public MMPose {
std::vector<int> input_size_{192, 256};
};

REGISTER_CODEBASE_COMPONENT(MMPose, SimCCLabelDecode);
MMDEPLOY_REGISTER_CODEBASE_COMPONENT(MMPose, SimCCLabelDecode);

} // namespace mmdeploy::mmpose

0 comments on commit b2c16d3

Please sign in to comment.