Exemple #1
0
 def export(self):
     shape = (1, 3, self.size[0], self.size[1])
     yolo_gluon.export(self.net,
                       shape,
                       self.ctx[0],
                       self.export_file,
                       onnx=1,
                       epoch=0)
Exemple #2
0
 def export(self):
     shape = (1, 3, self.size[0], self.size[1])
     yolo_gluon.export(self.net,
                       shape,
                       self.ctx[0],
                       self.export_folder,
                       onnx=False,
                       fp16=self.use_fp16)
Exemple #3
0
 def export(self):
     yolo_gluon.export(
         self.net,
         (1, 3, self.size[0], self.size[1]),
         self.ctx[0],
         self.export_folder,
         onnx=False,
         fp16=False)
Exemple #4
0
        bg = bg.data[0].as_in_context(ctx[0])
        imgs, labels = generator.render(bg)
        score_x, class_x = net(imgs)
        print(score_x.shape)
        print(class_x.shape)
        imgs = yolo_gluon.batch_ndimg_2_cv2img(imgs)
        for i in range(bs):
            ax = axs[i]
            s = score_x[i]
            s = nd.sigmoid(s.reshape(-1)).asnumpy()
            p = class_x[i, 0].asnumpy()
            p = np.argmax(p, axis=-1)
            yolo_cv.matplotlib_show_img(ax, imgs[i])
            ax.plot(range(8, 384, 16), (1 - s) * 160)
            ax.axis('off')

            s = np.concatenate(([0], s, [0]))
            # zero-dimensional arrays cannot be concatenated
            # Find peaks
            text = ''
            for i in range(24):
                if s[i + 1] > 0.2 and s[i + 1] > s[i + 2] and s[i + 1] > s[i]:
                    c = int(p[i])
                    text = text + cls_names[c]
            print(text)

        raw_input('press Enter to next batch....')

elif args.mode == 'export':
    yolo_gluon.export(net, (1, 3, size[0], size[1]), ctx[0], export_file)
Exemple #5
0
 def export(self):
     yolo_gluon.export(self.net, (1, 3, self.size[0], self.size[1]),
                       self.ctx[0],
                       self.export_file,
                       onnx=0,
                       epoch=0)