Closed duohappy closed 5 years ago
@duohappy Hi,
What repository do you use?
@duohappy Hi,
What repository do you use?
@AlexeyAB ,I just downloaded source code from your master branch repository.
I dont modify any code, and just open yolo_cpp_dll_no_gpu.sln to complie a dll.
I'm sorry, and I made a stupid mistake.
this reason why it can't work for me is that I don't realize local variable is released.
// metadata *metaMain = NULL;
// modify code as follow
metadata metaMain = { 0 };
void DarkYolo::load_dll(void)
{
this->hModule = LoadLibrary("./yolo_cpp_dll.dll");
if (this->hModule != NULL)
{
this->load_meta = (get_metadata)GetProcAddress(hModule, "get_metadata");
//this->metaMain = &(load_meta(this->metaPath));
// modify code as follow
this->metaMain = load_meta(this->metaPath);
}
// right
printf("%d\n", this->metaMain.classes);
for (int i = 0; i < 80; ++i)
{
printf("%s\n", this->metaMain.names[i]);
}
}
In order to explian, I adjust some code.
void DarkYolo::load_dll(void)
{
this->hModule = LoadLibrary("./yolo_cpp_dll.dll");
if (this->hModule != NULL)
{
this->load_meta = (get_metadata)GetProcAddress(hModule, "get_metadata");
metaInfo = load_meta(this->metaPath)
this->metaMain = &(metaInfo);
}
// variable 'metaInfo' is released
// *(this->metaMain) is a garbage value
printf("%d\n", this->metaMain->classes);
for (int i = 0; i < 80; ++i)
{
printf("%s\n", this->metaMain->names[i]);
}
}
OS: win7 64 IDE: visual studio 2017
I download souce code today, and complie to yolo_cpp_dll with yolo_cpp_dll_no_gpu.sln. But, get_metadata dosen't work well I debug it, but I cant find any reason.
//#define GPU //#define CUDNN
extern "C" {
ifdef GPU
ifdef CUDNN
endif
endif
ifdef GPU
endif
} typedef int(network_width)(network net); typedef int(network_height)(network net); typedef network (load_network_custom)(char cfg, char weights, int clear, int batch); typedef metadata(get_metadata)(char file); typedef image(load_image_color)(char filename, int w, int h); typedef float (network_predict_image)(network net, image im); typedef detection (get_network_boxes)(network net, int w, int h, float thresh, float hier, int map, int relative, int num, int letter); typedef void(do_nms_sort)(detection dets, int total, int classes, float thresh); typedef void(free_image)(image m); typedef void(free_detections)(detection *dets, int n);