コード例 #1
0
                    if success[0] != -1:
                        templateInfo[success[0]] = aTemplateInfo

                inout.save_info(tempInfo_saved_to.format(obj_id, radius), templateInfo)
                detector.writeClasses(template_saved_to)
                #  clear to save RAM
                detector.clear_classes()

    fbo.deactivate()
    window.close()

    elapsed_time = time.time() - start_time
    print('train time: {}\n'.format(elapsed_time))

if mode == 'test':
    poseRefine = linemodLevelup_pybind.poseRefine()

    im_size = dp['test_im_size']
    shape = (im_size[1], im_size[0])
    print('test img size: {}'.format(shape))

    # Frame buffer object, bind here to avoid memory leak, maybe?
    window = renderer.app.Window(visible=False)
    color_buf = np.zeros((shape[0], shape[1], 4), np.float32).view(renderer.gloo.TextureFloat2D)
    depth_buf = np.zeros((shape[0], shape[1]), np.float32).view(renderer.gloo.DepthTexture)
    fbo = renderer.gloo.FrameBuffer(color=color_buf, depth=depth_buf)
    fbo.activate()

    use_image_subset = True
    if use_image_subset:
        im_ids_sets = inout.load_yaml(dp['test_set_fpath'])
コード例 #2
0
ファイル: detect.py プロジェクト: eirikwha/6DPose
sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))

objIds = []

rgb = None
depth = None
lock = False
bridge = CvBridge()

readTemplFrom = './yaml/%s_templ.yaml'
readInfoFrom = './yaml/{}_info.yaml'
readModelFrom = './models/{0}/{0}.fly'
K_cam = None

detector = linemodLevelup_pybind.Detector()
poseRefine = linemodLevelup_pybind.poseRefine()
detector.readClasses(objIds, readTemplFrom)

infos = {}
models = {}
for id in objIds:
    model = inout.load_ply(readModelFrom.format(id))
    models[id] = model
    templateInfo = inout.load_info(readInfoFrom.format(id))
    infos[id] = templateInfo


def nms_norms(ts, scores, thresh):
    order = scores.argsort()[::-1]
    keep = []
    while order.size > 0:  # magic: order[[]] = []