mmdeploy/csrc/core/utils/formatter.h
Yue Zhou 9411fe0466
Add nms_rotated ort op (#312)
* fix pose demo and windows build (#307)

* init

* Update nms_rotated.cpp

* add postprocessing_masks gpu version (#276)

* add postprocessing_masks gpu version

* default device cpu

* pre-commit fix

Co-authored-by: hadoop-basecv <hadoop-basecv@set-gh-basecv-serving-classify11.mt>

* fixed a bug causes text-recognizer to fail when (non-NULL) empty bboxes list is passed (#310)

* [Fix] include missing <type_traits> for formatter.h (#313)

* fix formatter

* relax GCC version requirement

* fix

* fix lint

* fix lint

* [Fix] MMEditing cannot save results when testing (#336)

* fix show

* lint

* remove redundant codes

* resolve comment

* type hint

* docs(build): fix typo (#352)

* docs(build): add missing build option

* docs(build): add onnx install

* style(doc): trim whitespace

* docs(build): revert install onnx

* docs(build): add ncnn LD_LIBRARY_PATH

* docs(build): fix path error

* fix openvino export tmp model, add binary flag (#353)

* init circleci (#348)

* fix wrong input mat type (#362)

* fix wrong input mat type

* fix lint

* fix(docs): remove redundant doc tree (#360)

* fix missing ncnn_DIR & InferenceEngine_DIR (#364)

* update doc

Co-authored-by: Chen Xin <xinchen.tju@gmail.com>
Co-authored-by: Shengxi Li <982783556@qq.com>
Co-authored-by: hadoop-basecv <hadoop-basecv@set-gh-basecv-serving-classify11.mt>
Co-authored-by: lzhangzz <lzhang329@gmail.com>
Co-authored-by: Yifan Zhou <singlezombie@163.com>
Co-authored-by: tpoisonooo <khj.application@aliyun.com>
Co-authored-by: lvhan028 <lvhan_028@163.com>
2022-04-18 17:14:47 +08:00

63 lines
1.4 KiB
C++

// Copyright (c) OpenMMLab. All rights reserved.
#ifndef MMDEPLOY_SRC_UTILS_FORMATTER_H_
#define MMDEPLOY_SRC_UTILS_FORMATTER_H_
#include "core/logger.h"
#if FMT_VERSION >= 50000
#include "spdlog/fmt/bundled/ranges.h"
#else
#include <type_traits>
#endif
namespace mmdeploy {
class Value;
MMDEPLOY_API std::string format_value(const Value& value);
} // namespace mmdeploy
namespace fmt {
#if FMT_VERSION >= 50000
template <>
struct formatter<mmdeploy::Value> {
constexpr auto parse(format_parse_context& ctx) { return ctx.begin(); }
template <typename Context>
auto format(const mmdeploy::Value& value, Context& ctx) {
return format_to(ctx.out(), "{}", mmdeploy::format_value(value));
}
};
#else
inline void format_arg(BasicFormatter<char> &f, const char *, const mmdeploy::Value &d) {
f.writer() << mmdeploy::format_value(d);
}
template <typename T, std::enable_if_t<std::is_enum<std::decay_t<T> >::value, bool> = true>
void format_arg(BasicFormatter<char> &f, const char *, const T &v) {
f.writer() << (int)v;
}
template <typename T>
auto format_arg(BasicFormatter<char> &f, const char *, const T &v)
-> std::void_t<decltype(begin(v), end(v))> {
f.writer() << "[";
bool first = true;
for (const auto &x : v) {
f.writer() << (first ? "" : ", ") << fmt::format("{}", x);
first = false;
}
f.writer() << "]";
}
#endif
} // namespace fmt
#endif // MMDEPLOY_SRC_UTILS_FORMATTER_H_