ghgggg opened a new issue #12215: using C++ api in windows10 to extract feature 
error
URL: https://github.com/apache/incubator-mxnet/issues/12215
 
 
   i'm just using mxnet C++ api to extract feature  ,show the codes below
   
   
   cv::Mat img = _img.getMat();
                img.convertTo(img, CV_32F);
                img = (img - 127.5) / 128;
                static NDArray input(Shape(1, img.channels(), img.rows, 
img.cols), ctx);        //
                
   
                NDArray temp(Shape(1, img.channels(), img.rows, img.cols), 
Context(kCPU, 0),false); 
                NDArray::WaitAll();
                auto ptr = temp.GetData();
                std::vector<cv::Mat> chs(3);
                for (int i = img.channels() - 1; i >= 0; i--)
                {
                        chs[img.channels() - i - 1] = cv::Mat(img.size(), 
CV_32FC1, (float*)ptr + i*img.size().area());
                }
                cv::split(img, chs);
                //input = temp.Copy(ctx);
                input.SyncCopyFromCPU(temp.GetData(), temp.Size());
                NDArray::WaitAll();
                return Extract(input);
   
   when ctx = Context(kGPU, 0);
   the code     executor = net.SimpleBind(ctx, args_map, map<string, 
NDArray>(), map<string, OpReqType>(), aux_map);  occurs  error. but cpu mode 
all of them are OK.
   I don't know how to solve it ,anybody could help me ?thanks a lot
   

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

Reply via email to