boost-字符编码转换:使用conv

  Windows下的字符集转换可以使用WideCharToMultiByte/ MultiByteToWideChar,Linux下字符集转换可以使用iconv()函数,下面为使用boost的conv来进行字符集转换:

#include <boost/locale/encoding.hpp>

string UTF8toGBK(const string & str)
{
    return boost::locale::conv::between(str, "GBK", "UTF-8");
}

string GBKtoUTF8(const string & str)
{
    return boost::locale::conv::between(str, "UTF-8", "GBK");
}

wstring GBKtoUNICODE(const string & str)
{
    return boost::locale::conv::to_utf<wchar_t>(str, "GBK");
}

string UNICODEtoGBK(wstring wstr)
{
    return boost::locale::conv::from_utf(wstr, "GBK");
}

string UNICODEtoUTF8(const wstring& wstr)
{
    return boost::locale::conv::from_utf(wstr, "UTF-8");
}

wstring UTF8toUNICODE(const string & str)
{
    return boost::locale::conv::utf_to_utf<wchar_t>(str);
}

 

转载于:https://www.cnblogs.com/milanleon/p/7442920.html

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
[06/01/2023-16:46:00] [I] TensorRT version: 8.2.1 [06/01/2023-16:46:01] [I] [TRT] [MemUsageChange] Init CUDA: CPU +323, GPU +0, now: CPU 335, GPU 1071 (MiB) [06/01/2023-16:46:01] [I] [TRT] [MemUsageSnapshot] Begin constructing builder kernel library: CPU 335 MiB, GPU 1067 MiB [06/01/2023-16:46:01] [I] [TRT] [MemUsageSnapshot] End constructing builder kernel library: CPU 470 MiB, GPU 1101 MiB [06/01/2023-16:46:01] [I] Start parsing network model [06/01/2023-16:46:01] [I] [TRT] ---------------------------------------------------------------- [06/01/2023-16:46:01] [I] [TRT] Input filename: /opt/projects/ultralytics/runs/detect/train/weights/best.onnx [06/01/2023-16:46:01] [I] [TRT] ONNX IR version: 0.0.8 [06/01/2023-16:46:01] [I] [TRT] Opset version: 17 [06/01/2023-16:46:01] [I] [TRT] Producer name: pytorch [06/01/2023-16:46:01] [I] [TRT] Producer version: 2.0.0 [06/01/2023-16:46:01] [I] [TRT] Domain: [06/01/2023-16:46:01] [I] [TRT] Model version: 0 [06/01/2023-16:46:01] [I] [TRT] Doc string: [06/01/2023-16:46:01] [I] [TRT] ---------------------------------------------------------------- [06/01/2023-16:46:01] [W] [TRT] onnx2trt_utils.cpp:366: Your ONNX model has been generated with INT64 weights, while TensorRT does not natively support INT64. Attempting to cast down to INT32. [06/01/2023-16:46:01] [E] [TRT] ModelImporter.cpp:773: While parsing node number 263 [Conv -> "/model.28/cv2.3/cv2.3.2/Conv_output_0"]: [06/01/2023-16:46:01] [E] [TRT] ModelImporter.cpp:774: --- Begin node --- [06/01/2023-16:46:01] [E] [TRT] ModelImporter.cpp:775: input: "/model.28/cv2.3/cv2.3.1/act/Mul_output_0" input: "model.28.cv2.3.2.weight" input: "model.28.cv2.3.2.bias" output: "/model.28/cv2.3/cv2.3.2/Conv_output_0" name: "/model.28/cv2.3/cv2.3.2/Conv" op_type: "Conv" attribute { name: "dilations" ints: 1 ints: 1 type: INTS } attribute { name: "group" i: 1 type: INT } attribute { name: "kernel_shape" ints: 1 ints: 1 type: INTS } attribute { name: "pads" ints: 0 ints: 0 ints: 0 ints: 0 type: INTS } attribute { name: "strides" ints: 1 ints: 1 type: INTS } [06/01/2023-16:46:01] [E] [TRT] ModelImporter.cpp:776: --- End node --- [06/01/2023-16:46:01] [E] [TRT] ModelImporter.cpp:779: ERROR: builtin_op_importers.cpp:647 In function importConv: [8] Assertion failed: inputs.at(2).is_weights() && "The bias tensor is required to be an initializer for the Conv operator." [06/01/2023-16:46:01] [E] Failed to parse onnx file
06-02

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值