scanner-research / scanner

Efficient video analysis at scale
https://scanner-research.github.io/
Apache License 2.0
620 stars 108 forks source link

custom python ops hangs #220

Closed PushyamiKaveti closed 6 years ago

PushyamiKaveti commented 6 years ago

Hi, I have been ardently trying to create custom python op for crop. I followed the example for resize. The following is my code

@scannerpy.register_python_op()
def crop_fn(config, frame: FrameType) -> FrameType:
    n = frame[0:480, 0:640, :]
    return n

I tried debugging the code. It turns out that when I am returning the cropped ndarray the function freezes. If I just return the input frame itself, it works. Not sure why returning a different size image is causing trouble. The resize function provided in examples also does not work. Any thoughts on this?

fpoms commented 6 years ago

What is the resolution of your input video? If you are trying to crop a region which is larger than the video frame, it will cause issues.

Can you try cropping a smaller region, like [0:50, 0:100, :], and let me know what happens?

fpoms commented 6 years ago

Ah, nevermind. This is actually a bug! Pushing a fix in a few minutes.

fpoms commented 6 years ago

Just pushed a fix. If you grab the latest source (or docker image, in about 20 minutes) your issue should be fixed!

PushyamiKaveti commented 6 years ago

Thank you. I will check out the fix. Coming to your question about video crop region I was choosing a smaller size. The original video is 1280 X 720

PushyamiKaveti commented 6 years ago

@apoms ... I grabbed a new docker image using docker-compose run --service-ports gpu /bin/bash and tried the custom op. It still hangs. Is there a specific docker image I need to pull.

PushyamiKaveti commented 6 years ago

@apoms .. Sorry! I did not actually pull in the latest image earlier. The custom ops for crop works now. Thankd