Ask Your Question

Revision history [back]

Can you please suggest how to replace this code with OpenCV's darknet implementation ?

Hi , I came across a code which uses custom YoLo model.

argv['LABELS']        = self.LABELS
        argv['BATCH_SIZE']    = self.BATCH_SIZE * self.SEQUENCE_LENGTH
        argv['IMAGE_H']       = self.IMAGE_H
        argv['IMAGE_W']       = self.IMAGE_W
        argv['GRID_H']        = self.GRID_H
        argv['GRID_W']        = self.GRID_W

    self.detector = KerasYOLO(argv)

 self.model_detector = Model( inputs=self.detector.model.input[0],
                                     outputs=[ self.detector.model.get_layer('conv_23').output,
                                               self.detector.model.get_layer('conv_feat').output])

Now, I want to replace this self.detector object with readNetFromDarknet

I could not find out functions, which could replace self.detector.model.input[0] and self.detector.model.get_layer('<layer_id>').output

All I found out was this documented function [getLayerShapes]. (https://docs.opencv.org/3.4/db/d30/classcv_1_1dnn_1_1Net.html#ad0d10b1ff622c89562d2befaf351af45)

But , I am not able to use it.

Can anyone please help ?

Thanks in advance.

Can you please suggest how to replace this code with OpenCV's darknet implementation ?

Hi , I came across a code which uses custom YoLo model.

argv['LABELS']        = self.LABELS
        argv['BATCH_SIZE']    = self.BATCH_SIZE * self.SEQUENCE_LENGTH
        argv['IMAGE_H']       = self.IMAGE_H
        argv['IMAGE_W']       = self.IMAGE_W
        argv['GRID_H']        = self.GRID_H
        argv['GRID_W']        = self.GRID_W

    self.detector = KerasYOLO(argv)

 self.model_detector = Model( inputs=self.detector.model.input[0],
                                     outputs=[ self.detector.model.get_layer('conv_23').output,
                                               self.detector.model.get_layer('conv_feat').output])

Now, I want to replace this self.detector object with readNetFromDarknet

I could not find out functions, which could replace self.detector.model.input[0] and self.detector.model.get_layer('<layer_id>').output

All I found out was this documented function [getLayerShapes]. (https://docs.opencv.org/3.4/db/d30/classcv_1_1dnn_1_1Net.html#ad0d10b1ff622c89562d2befaf351af45)

But , I am not able to use it. the functioin getLayerShapes takes netInputShape as parameter. How can I get that ?

Can anyone please help ?

Thanks in advance.