我正在尝试使用TensorRT部署经过培训的U-Net。使用Keras(以Tensorflow作为后端)对模型进行了训练。代码与这一代码非常相似:https : //github.com/zhixuhao/unet/blob/master/model.py
当我将模型转换为UFF格式时,使用如下代码:
import uff
import os
uff_fname = os.path.join("./models/", "model_" + idx + ".uff")
uff_model = uff.from_tensorflow_frozen_model(
frozen_file = os.path.join('./models', trt_fname), output_nodes = output_names,
output_filename = uff_fname
)
Run Code Online (Sandbox Code Playgroud)
我将收到以下警告:
Warning: No conversion function registered for layer: ResizeNearestNeighbor yet.
Converting up_sampling2d_32_12/ResizeNearestNeighbor as custom op: ResizeNearestNeighbor
Warning: No conversion function registered for layer: DataFormatVecPermute yet.
Converting up_sampling2d_32_12/Shape-0-0-VecPermuteNCHWToNHWC-LayoutOptimizer as custom op: DataFormatVecPermute
Run Code Online (Sandbox Code Playgroud)
我试图通过用upsampling(双线性插值)替换upsampling层并转置卷积来避免这种情况。但是转换器会抛出类似的错误。我检查了https://docs.nvidia.com/deeplearning/sdk/tensorrt-support-matrix/index.html,似乎还不支持所有这些操作。
我想知道是否有解决此问题的方法?TensorRT还喜欢其他格式并支持上采样吗?还是可以用其他受支持的操作替换它?
我还看到某处可以添加自定义操作来替换那些不支持TensorRT的操作。虽然我不太确定工作流程如何。如果有人可以指出自定义图层的示例,那也将非常有帮助。
先感谢您!
我试图让SDL库在我的macbook上工作,在c中写一个小游戏(可能是俄罗斯方块).我在https://wiki.libsdl.org/Installation上阅读并遵循了SDL的安装说明.
但是,当我尝试编译以下c代码时:
#include <SDL2/SDL.h>
#include <stdio.h>
int main()
{
SDL_Init(SDL_INIT_VIDEO);
printf("Window Initialization!\n");
SDL_Window *window;
//printf("SDL_WINDOWPOS_CENTERED is %d\n", SDL_WINDOWPOS_CENTERED);
window = SDL_CreateWindow(
"SDL2 Test",
SDL_WINDOWPOS_CENTERED,
SDL_WINDOWPOS_CENTERED,
640, 480, 0);
if(window == NULL){
printf("Creation of Window Failed\n");
SDL_Quit();
return -1;
}
SDL_Delay(3000); //delay for 3000 ms
SDL_Renderer* rend = NULL;
SDL_DestroyWindow(window);
SDL_Quit();
return 0;
}
Run Code Online (Sandbox Code Playgroud)
使用命令:
gcc main.c -o run
Run Code Online (Sandbox Code Playgroud)
打印以下错误:
Undefined symbols for architecture x86_64:
"_SDL_CreateWindow", referenced from:
_main in sdl1-a80c27.o
"_SDL_Delay", referenced from:
_main in sdl1-a80c27.o
"_SDL_DestroyWindow", referenced …Run Code Online (Sandbox Code Playgroud)