prabindh / darknet

Convolutional Neural Networks
http://pjreddie.com/darknet/
Other
122 stars 46 forks source link

Video of type 8UC1 is not working #62

Closed shaikhibrahim951 closed 6 years ago

shaikhibrahim951 commented 6 years ago

Hi I am giving my video from ToF(Time of flight camera) and video is of 8UC1v type. In __detect function it is taking 3 channel data in concatenated form, but I want to take only 1 channel data, can you help me regarding this.

Thanks

prabindh commented 6 years ago

Have you been able to train Yolov3 using 1-channel, to generate a working model ?

prabindh commented 6 years ago

A simple way could be, to convert C1 to BGRA using something like, cvtColor(src,dst,CV_GRAY2RGB);, before feeding to the detect function.

prabindh commented 6 years ago

To do it efficiently with 1 channel itself without conversion, can you provide a trained model, so I can verify the detection changes ?

shaikhibrahim951 commented 6 years ago

I am training data using Yolov2a and image type is 1 channel. The code is giving problem in following line. Image is getting converted to floatMat, then following process is happening.

` if (floatMat.channels() != 3) { EPRINTF("Detect: channels = %d \n", floatMat.channels()); return false; } // Get the image to suit darknet cv::Mat floatMatChannels[3]; cv::split(floatMat, floatMatChannels); vconcat(floatMatChannels[0], floatMatChannels[1], floatMat); vconcat(floatMat, floatMatChannels[2], floatMat);

__Detect((float*)floatMat.data, thresh, hier_thresh, objectCount);`

It is going to this if condition if (floatMat.channels() != 3)

Image is not passing to __detect function.

Thanks

prabindh commented 6 years ago

Did you try this suggestion - "A simple way could be, to convert C1 to BGRA using something like, cvtColor(src,dst,CV_GRAY2RGB);, before feeding to the detect function."

prabindh commented 6 years ago

Could you also specify which camera you are using so I could try some sample data ?

shaikhibrahim951 commented 6 years ago

cvtColor(src,dst,CV_GRAY2RGB); worked for me and able to detect desired object in frame. I am using Melaxis ToF camera.

prabindh commented 6 years ago

Very good and thanks for confirming. If permitted by your project, also please share some sample train images you are using.

prabindh commented 6 years ago

Closing as the issue is resolved.