aws-samples / amazon-rekognition-video-analyzer

A working prototype for capturing frames off of a live MJPEG video stream, identifying objects in near real-time using deep learning, and triggering actions based on an objects watch list.
Other
368 stars 158 forks source link

Speeding up processing #35

Closed jaweiss8 closed 6 years ago

jaweiss8 commented 6 years ago

I'm noticing that the screenshots in the web ui are about a minute behind real time. What part of this configuration is the main cause of the slowdown? Is it Kinesis? How would you increase Kinesis's processing speed?

jaweiss8 commented 6 years ago

Would you increase the number of shards?

moanany commented 6 years ago

Hi @jaweiss8,

There could be several reasons for this high latency you're observing. A potential cause could be network latency between video client and Kinesis or between API Gateway and your browser. Has this been ruled out already?

Thanks, Moataz

jaweiss8 commented 6 years ago

Hi @moanany,

I believe the slowdown is occurring between the video client and rekognition. I timed it and it takes anywhere from seven seconds to 30 seconds for a frame from the video client to be sent to rekognition. Do you think this can be improved by increasing the number of shards? Or do you think it is more a matter of running the video analyzer on a more powerful wifi-network? How close to real-time is the video analyzer on your network?

Thanks, Jacob

moanany commented 6 years ago

Kinesis supports up to 1MiB/sec ingest throughput and as long as you're not getting ProvisionedThroughputExceededException, then Kinesis is able to handle the throughput or requests/sec requirement. When you start getting those, then it signals the need for more shards.

I would recommend you start by measuring latency from the video capture client's network to the AWS region where you deployed the stack. For example, https://cloudharmony.com/speedtest-for-aws seems to provide this kind of measurement.

If latencies look OK, next thing I would look at is the processing power of the video capture client device, and whether it is able to capture, package, and stream the frames without excessive delays.

Based on the configurations I've tested, the delay between capture and seeing frames in the Web UI should be in the order of a few seconds.

moanany commented 6 years ago

Please reopen issue if needed. Thanks!