sess_input = [model.final_boxes, model.final_labels,
                          model.final_probs]
            final_boxes, final_labels, final_probs = sess.run(
                sess_input, feed_dict=feed_dict)

        if args.out_dir is None:
          cur_frame += 1
          continue

        # ---------------- get the json outputs for object detection

        # scale back the box to original image size
        final_boxes = final_boxes / scale

        if args.add_mask:
          final_masks = [fill_full_mask(box, mask, im.shape[:2])
                         for box, mask in zip(final_boxes, final_masks)]

        # save as json
        pred = []

        for j, (box, prob, label) in enumerate(zip(
            final_boxes, final_probs, final_labels)):
          box[2] -= box[0]
          box[3] -= box[1]  # produce x,y,w,h output

          cat_id = int(label)
          cat_name = targetid2class[cat_id]

          # encode mask
          rle = None
                        final_labels[i] = coco_obj_class_to_id[
                            args.partial_classes[final_labels[i] - 1]]
                else:
                    # 1-90 to 1-80
                    for i in range(len(final_labels)):
                        final_labels[i] = \
                            coco_obj_class_to_id[coco_id_mapping[final_labels[i]]]

            # ---------------- get the json outputs for object detection

            # scale back the box to original image size
            final_boxes = final_boxes / scale

            if args.add_mask:
                final_masks = [
                    fill_full_mask(box, mask, im.shape[:2])
                    for box, mask in zip(final_boxes, final_masks)
                ]

            # save as json
            pred = []

            for j, (box, prob, label) in enumerate(
                    zip(final_boxes, final_probs, final_labels)):
                box[2] -= box[0]
                box[3] -= box[1]  # produce x,y,w,h output

                cat_id = int(label)
                cat_name = targetid2class[cat_id]

                # encode mask
Beispiel #3
0
          if args.add_mask:
            sess_input = [model.final_boxes, model.final_labels, model.final_probs, model.final_masks]
            final_boxes, final_labels, final_probs, final_masks = sess.run(sess_input, feed_dict=feed_dict)
          else:
            sess_input = [model.final_boxes, model.final_labels, model.final_probs]
            final_boxes, final_labels, final_probs = sess.run(sess_input, feed_dict=feed_dict)

        if args.out_dir is None:
          cur_frame += 1
          continue

        # scale back the box to original image size
        final_boxes = final_boxes / scale

        if args.add_mask:
          final_masks = [fill_full_mask(box, mask, im.shape[:2]) for box, mask in zip(final_boxes, final_masks)]

        # save as json
        pred = []

        for j, (box, prob, label) in enumerate(zip(final_boxes, final_probs, final_labels)):
          box[2] -= box[0]
          box[3] -= box[1]  # produce x,y,w,h output


          cat_id = label
          cat_name = targetid2class[cat_id]

          # encode mask
          rle = None
          if args.add_mask: