scanner icon indicating copy to clipboard operation
scanner copied to clipboard

error with “scannerpy.common.ScannerException: Attempted to re-register op MTCNNDetectFaces:26b1de2b94414c76b520eb59bd0ef338”

Open ABNER-1 opened this issue 6 years ago • 0 comments

I get a error "scannerpy.common.ScannerException: Attempted to re-register op MTCNNDetectFaces:26b1de2b94414c76b520eb59bd0ef338" when I run a simple demo with face_detect code. It can be simplified with these code:

def detect_face_from_video(video_path):
    sc = sp.Client()
    video = sp.NamedVideoStream(sc, 'example', path=video_path)
    frames = sc.io.Input([video])
    # detect faces
    faces = sc.ops.MTCNNDetectFaces(frame=frames)
    # convert into vector
    feature = sc.ops.EmbedFaces(frame = frames, bboxes = faces)

    output_feature = sp.NamedStream(sc, "example_feature")
    extrace_feature_op = sc.io.Output(feature, [output_feature])
    sc.run(extrace_feature_op, sp.PerfParams.estimate(), cache_mode=sp.CacheMode.Overwrite)

    bytes = output_feature.load()
    bounds = save_vector_to_file(bytes)
    return bounds

bounds = detect_face_from_video(src_video)
bounds = detect_face_from_video(src_video)

Can not I use an op twice in a python script? I find it registers the ops into client and already write into the _python_ops, but why it register too when second invoke the getattr function?

ABNER-1 avatar Jan 17 '20 07:01 ABNER-1