aws/amazon-kinesis-video-streams-parser-library

Use with SageMaker instead of Rekognition

mapavia opened this issue · 7 comments

I actually don't know where to start, but I already have a Sagemaker endpoint for object detection with Kinesis Video Stream. And I would like to add bounding boxes to it.

I just started using this with Rekognition and I want to change it to Sagemaker. And I don't know where to actually start editing. Any help would be great.

qqia commented

Hi @mapavia

Thanks for your interests in our library.

You can take a look at line: https://github.com/aws/amazon-kinesis-video-streams-parser-library/blob/master/src/main/java/com/amazonaws/kinesisvideo/parser/examples/lambda/H264FrameProcessor.java#L129.
It gives a decoded video frame and you can customize the code path sending frame to SageMaker.

You can also refer to our other blog post: https://aws.amazon.com/blogs/machine-learning/analyze-live-video-at-scale-in-real-time-using-amazon-kinesis-video-streams-and-amazon-sagemaker/
integrating KVS service with SageMaker.

Hi @qqia , I came to this repo from the KVS + SM blog post. The solution given there only allows for i-frame extraction, which is too slow for my use case. Does this library do arbitrary frame extraction?

Hi @mapavia

Thanks for your interests in our library.

You can take a look at line: https://github.com/aws/amazon-kinesis-video-streams-parser-library/blob/master/src/main/java/com/amazonaws/kinesisvideo/parser/examples/lambda/H264FrameProcessor.java#L129.
It gives a decoded video frame and you can customize the code path sending frame to SageMaker.

You can also refer to our other blog post: https://aws.amazon.com/blogs/machine-learning/analyze-live-video-at-scale-in-real-time-using-amazon-kinesis-video-streams-and-amazon-sagemaker/
integrating KVS service with SageMaker.

Good day,

I don't know how to even start editing the line you mentioned. Any more specific guidance? Thank you.

I already have set up the blog post you mentioned. I just need the bounding boxes.

Hi @qqia, can you tell me what to change to send to SageMaker. I don't understand anything from the line you quoted. :(

ievbu commented

@kenstler @mapavia have you found a solution to send every frame to SageMaker endpoint?

@mapavia @ievbu from what I understand you are asking for a way to send each decoded frame to your own SageMaker endpoint, correct? The line @qqia pointed is a function that processes each frame sequentially. In this case, it decodes the original frame, gets the corresponding bounding box info from the Rekognition output, renders the bounding box on the decoded frame, encodes it and sends it to another KVS stream. This sample code can be used as a boiler plate for your application but remove all rekognition stuff, in the process function decode your frame and use your endpoint to send the decoded frame to.

@qqia the KVS sagemaker post doesn't seem to actually provide the code--I can only find the docker image reference in the cfn template. Is the code for the docker image available anywhere?