Giter Site home page Giter Site logo

aws-samples / amazon-rekognition-video-analyzer Goto Github PK

View Code? Open in Web Editor NEW
366.0 74.0 157.0 813 KB

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.

License: Other

Python 11.48% HTML 1.09% CSS 1.33% JavaScript 86.09%
video video-processing python opencv aws aws-lambda mjpeg amazon-web-services amazon-rekognition machine-learning

amazon-rekognition-video-analyzer's Issues

Same Local Area Network as Video Capture Client

Hello,
We installed all software on ec2. Our IP camera is working but when I run the command pynt videocaptureip["http://[email protected]******/video/mjpg.cgi",20] the connection is not made.

Would this have been related to the comment in your documentation below:

If you use an IP camera, make sure your camera is connected to the same Local Area Network as the Video Capture client?

Thank you

Error with build.py file

Hi,

I am trying to run pynt -l and I am getting an syntax error:

File "build.py", line 25
print 'zipping %s as %s' % (os.path.join(dirname, filename),
^
SyntaxError: invalid syntax

Looking at the code in build.py the For loop does not seem to be complete. Could you please assist, thanks.

createstack issue

some time it create stack and some time it's fails. there is any way so that on first command run (pynt createstack) it can create a stack in cloud formation.

pynt createstack - Waiter encountered a terminal failure state

When calling pynt createstack, I am encountering the following error: botocore.exceptions.WaiterError: Waiter StackCreateComplete failed: Waiter encountered a terminal failure state.

If I insert boto3 logging, the following DEBUG information gets outputted before the build crashes:

botocore.hooks [DEBUG] Event needs-retry.cloudformation.DescribeStacks: calling handler <botocore.retryhandler.RetryHandler object at 0x7fcd5c83ad10>
botocore.retryhandler [DEBUG] No retry needed.

If I run pynt stackstatus after the error, it gives me the status ROLLBACK_COMPLETE.

It seems to be retrying this a couple of times before finally giving up and aborting. Is there any insight on why this might be happening?

Thanks in advance.

Typo in the Readme: parameter RtRekogS3BucketNameParameter in cfn-params.json does not exist

For parameter s3_bucket of imageprocessor-params.json, the instructions in the readme file say:

The value specified here must match the value specified for the RtRekogS3BucketNameParameter parameter in the cfn-params.json file.

However, the parameter RtRekogS3BucketNameParameter is not defined in cfn-params.json.
This parameter is not used in any programs either.

This could be a typo, or is it the FrameS3BucketNameParameter that it is trying to refer to?

Having Trouble Creating Stack

I am getting the 'ROLLBACK_COMPLETE' status when I check on my stack. When I try to run pynt createstack again, I get the error: CreateStack operation: Stack [video-analyzer-stack] already exists.

When I try to check on the status of my stack via the cloudFormation console attached to my AWS account, it says that I do not have any stacks.

I am a little bit stuck because I cannot create a new stack since apparently it exists somewhere... That being said, it dos not appear on the cloudformation console associated with my account. I have checked that my aws cli has been configured correctly and the lambda function has been successful in creating a bucket.

Please let me know if you have any next steps for debugging. Thanks!

Duplicate SNS text

I have this demo code up and running against my front door IP camera. It's working well, but when a person is in more than one frame, I get multiple SMS notifications. What's the best way to de-dup notifications?

Would it be possible to group frames and send one message?

pynt webui gives error

hello,

when i run pynt webui it gives following error

[ build.pyc - Starting task "webui" ]
Copying Web UI source from 'web-ui/' to build directory.
Retrieving API key from stack 'video-analyzer-stack'.
[ build.pyc - Error in task "webui" ]
[ build.pyc - Aborting build ]
Traceback (most recent call last):
File "/home/einfochips/kinesisvideo/bin/pynt", line 11, in
sys.exit(main())
File "/home/einfochips/kinesisvideo/local/lib/python2.7/site-packages/pynt/_pynt.py", line 295, in main
build(sys.argv[1:])
File "/home/einfochips/kinesisvideo/local/lib/python2.7/site-packages/pynt/_pynt.py", line 59, in build
_run_from_task_names(module,args.tasks)
File "/home/einfochips/kinesisvideo/local/lib/python2.7/site-packages/pynt/_pynt.py", line 109, in _run_from_task_names
_run(module, logger, task, completed_tasks, True, args, kwargs)
File "/home/einfochips/kinesisvideo/local/lib/python2.7/site-packages/pynt/_pynt.py", line 180, in _run
task(*(args or []),**(kwargs or {}))
File "/home/einfochips/kinesisvideo/local/lib/python2.7/site-packages/pynt/_pynt.py", line 242, in call
self.func.call(*args,**kwargs)
File "build.py", line 326, in webui
LogicalResourceId=cfn_params_dict["ApiGatewayRestApiNameParameter"]
File "/home/einfochips/kinesisvideo/local/lib/python2.7/site-packages/botocore/client.py", line 317, in _api_call
return self._make_api_call(operation_name, kwargs)
File "/home/einfochips/kinesisvideo/local/lib/python2.7/site-packages/botocore/client.py", line 615, in _make_api_call
raise error_class(parsed_response, operation_name)
botocore.exceptions.ClientError: An error occurred (ValidationError) when calling the DescribeStackResource operation: Resource VidAnalyzerRestApi does not exist for stack video-analyzer-stack

build.py assumes Python 2

Although early in the instructions you mention Python 2 or Python 3, when I got to

pynt -l

I got an error from build.py

I took a quick look and see it that at the very least the print statements are written for Python 2 only.

Are you intending to release a Python 3 version of this?

I'm bummed because I now have to go back and build a new environment using Python 2.

Making it work with a USB camera

Thank you for this wonderful project and the extensive detailed documentation. Really appreciate the effort you have put into this.

All the steps worked wonderfully well on a Fedora 26 x86_64 machine with compiled opencv 3.3.1. The stack is created successfully too.

I do not have a IP camera (yet) and working on installing a IP camera app on my phone to test. In the mean time, I'm using a USB webcam Logitech C930e to test. pynt videocapture[20] does not seem to capture video frames.

pynt videocapture[20]
[ build.pyc - Starting task "videocapture" ]
[ build.pyc - Completed task "videocapture" ]

Any help would be appreciated if I have to pass any additional parameters for USB device. I will try the IP camera in the mean time.

Final step videocapture

i've made it to last step pynt videocaptureip["<your-ip-cam-mjpeg-url>"],but im running with some issues,im hoping someone can tell me if im missing something when executing the last part

via ip camera:

i keep getting and error type,it connects for a second and then it dies....the message that im getting is thi:

[ build.py - Starting task "videocaptureip" ] Capturing from 'http://192.168.1.78:8081' at a rate of 1 every 20 frames... Traceback (most recent call last): File "video_cap_ipcam.py", line 141, in <module> main() File "video_cap_ipcam.py", line 105, in main bytes += stream.read(16384*2) TypeError: can only concatenate str (not "bytes") to str [ build.py - Completed task "videocaptureip"

Via web cam:

when i run it it seems to work because i keep getting

{'ShardId': 'shardId-000000000000', 'SequenceNumber': '49597758662347182382206873118270965332318602047252332546', 'ResponseMetadata': {'RequestId': 'c2c360dd-dd9c-3541-976f-38d97fe5e46b', 'HTTPStatusCode': 200, 'HTTPHeaders': {'x-amzn-requestid': 'c2c360dd-dd9c-3541-976f-38d97fe5e46b', 'x-amz-id-2': 'WoUPxGafWCb/ZB3aakhu/0/F8jCK9Hzbylv22q4UZHrK0pQ4XlWF9stz0GoBX7jbX9UUWDxuZmXXvsxZGuRD2rpdV38z8HFWPhw+Jg7iSVk=', 'date': 'Fri, 19 Jul 2019 23:44:04 GMT', 'content-type': 'application/x-amz-json-1.1', 'content-length': '110'}, 'RetryAttempts': 0}}

but after i execute this step, nothing appears on the dashed area in the Web UI(waited a couple minutes)

importan note: i did changed/convert some files to python3 since im running the project on it
files changed:

  • imageprocessor.py
  • video_cap.py
  • video_cap_ipcam.py
  • build.py
    also changed the cPickle lib to pickle

Pd: pynt stackstatus is a green light
[ build.py - Starting task "stackstatus" ] Stack 'video-analyzer-stack' has the status 'CREATE_COMPLETE' [ build.py - Completed task "stackstatus" ]
Any help on this is gladly appreciated

unsupported pickle protocol: 3

I think it has something to do with running python 3 on my computer for the pynt videocapture and
and imageprocessor.py running in python 2? I don't want to reset up my environment. Is this is whats happening? Is there another fix?

unsupported pickle protocol: 3: ValueError
Traceback (most recent call last):
File "/var/task/imageprocessor.py", line 243, in handler
return process_image(event, context)
File "/var/task/imageprocessor.py", line 69, in process_image
frame_package = cPickle.loads(base64.b64decode(frame_package_b64))
ValueError: unsupported pickle protocol: 3

'JobStatus': 'FAILED', 'StatusMessage': 'Unsupported codec/format.'

Hi I am able to search matched faces in a video. But sometimes I get above error. The error comes when the video format is not supported by aws recognition.
When I get that video from an android phone it works but if I get that video from other sources like web then it throw the error.

I want to know how can I convert any video(whatever the source) to the aws supported video using ffmpeg
Thanks

any one help?

pynt deploylambda
[ build.pyc - Starting task "deploylambda" ]
Checking if S3 Bucket 'anbanglee2' exists...
Uploading function 'framefetcher' to 'src/lambda_framefetcher.zip'
[ build.pyc - Error in task "deploylambda" ]
[ build.pyc - Aborting build ]
Traceback (most recent call last):
File "/Users/anbanglee/anaconda2/bin/pynt", line 11, in
sys.exit(main())
File "/Users/anbanglee/anaconda2/lib/python2.7/site-packages/pynt/_pynt.py", line 298, in main
build(sys.argv[1:])
File "/Users/anbanglee/anaconda2/lib/python2.7/site-packages/pynt/_pynt.py", line 59, in build
_run_from_task_names(module,args.tasks)
File "/Users/anbanglee/anaconda2/lib/python2.7/site-packages/pynt/_pynt.py", line 109, in _run_from_task_names
_run(module, logger, task, completed_tasks, True, args, kwargs)
File "/Users/anbanglee/anaconda2/lib/python2.7/site-packages/pynt/_pynt.py", line 180, in _run
task(*(args or []),**(kwargs or {}))
File "/Users/anbanglee/anaconda2/lib/python2.7/site-packages/pynt/_pynt.py", line 245, in call
self.func.call(*args,**kwargs)
File "build.py", line 143, in deploylambda
s3_client.upload_fileobj(data, src_s3_bucket_name, s3_keys[function])
File "/Users/anbanglee/anaconda2/lib/python2.7/site-packages/boto3/s3/inject.py", line 539, in upload_fileobj
return future.result()
File "/Users/anbanglee/.local/lib/python2.7/site-packages/s3transfer/futures.py", line 73, in result
return self._coordinator.result()
File "/Users/anbanglee/.local/lib/python2.7/site-packages/s3transfer/futures.py", line 233, in result
raise self._exception
botocore.exceptions.ClientError: An error occurred (SignatureDoesNotMatch) when calling the PutObject operation: The request signature we calculated does not match the signature you provided. Check your key and signing method.

pynt createstack :

hi
command pynt createstack giving error : AlreadeyExistsException: an error occured when calling the createstack operation: stack [video-analyzer-stack] already exists.

please help me.

Thanks

where to write these settings ?

hi everyone !
i have completed first 10 steps and now i got stuck. i have no idea how to proceed further. where to write these configurations. please help me.
thanks

pynt webui:

hi,

pynt webui giving error: an error occured when calling the describestackresource operation: resource vidanalyzerrestapi does not exist for stack video-analyzer-stack.

please help me

Thanks

Multiple streams

Is there a way to setup multiple stream inputs; example multiple IP cameras.

ImportError: No module named cv2

Hi,
I followed all the steps when i run pynt videocaptureip["",] , I get
[ build.pyc - Starting task "videocaptureip" ]
Traceback (most recent call last):
File "video_cap_ipcam.py", line 13, in
import cv2
ImportError: No module named cv2
[ build.pyc - Completed task "videocaptureip" ]
. can anyone help me.

video not appearing on web ui

sir,thank you soo much for an such wonderfull project.the problem what i face is that videos are not showing up at webui..i checked the cloudwatch logs for improcessor lambda and it shown an error which i am posting below:


13:15:25
END RequestId: 0b6d13ac-f996-4f68-95ce-66f345f9bbc4

13:15:25
REPORT RequestId: 0b6d13ac-f996-4f68-95ce-66f345f9bbc4 Duration: 2029.31 ms Billed Duration: 2100 ms Memory Size: 128 MB Max Memory Used: 53 MB

13:15:26
START RequestId: 0b6d13ac-f996-4f68-95ce-66f345f9bbc4 Version: $LATEST

13:15:26
Expecting property name: line 10 column 2 (char 206): ValueError Traceback (most recent call last): File "/var/task/imageprocessor.py", line 182, in handler return process_image(event, context) File "/var/task/imageprocessor.py", line 48, in process_image config = load_config() File "/var/task/imageprocessor.py", line 24, in load_config return json.loads(conf_json) File "/usr/l
Expecting property name: line 10 column 2 (char 206): ValueError
Traceback (most recent call last):
File "/var/task/imageprocessor.py", line 182, in handler
return process_image(event, context)
File "/var/task/imageprocessor.py", line 48, in process_image
config = load_config()
File "/var/task/imageprocessor.py", line 24, in load_config
return json.loads(conf_json)
File "/usr/lib64/python2.7/json/init.py", line 339, in loads
return _default_decoder.decode(s)
File "/usr/lib64/python2.7/json/decoder.py", line 364, in decode
obj, end = self.raw_decode(s, idx=_w(s, 0).end())
File "/usr/lib64/python2.7/json/decoder.py", line 380, in raw_decode
obj, end = self.scan_once(s, idx)
ValueError: Expecting property name: line 10 column 2 (char 206)


13:15:26
END RequestId: 0b6d13ac-f996-4f68-95ce-66f345f9bbc4

13:15:26
REPORT RequestId: 0b6d13ac-f996-4f68-95ce-66f345f9bbc4 Duration: 546.06 ms Billed Duration: 600 ms Memory Size: 128 MB Max Memory Used: 53 MB

13:15:27
START RequestId: 0b6d13ac-f996-4f68-95ce-66f345f9bbc4 Version: $LATEST

13:15:27
Expecting property name: line 10 column 2 (char 206): ValueError Traceback (most recent call last): File "/var/task/imageprocessor.py", line 182, in handler return process_image(event, context) File "/var/task/imageprocessor.py", line 48, in process_image config = load_config() File "/var/task/imageprocessor.py", line 24, in load_config return json.loads(conf_json) File "/usr/l

13:15:27
END RequestId: 0b6d13ac-f996-4f68-95ce-66f345f9bbc4

13:15:27
REPORT RequestId: 0b6d13ac-f996-4f68-95ce-66f345f9bbc4 Duration: 157.44 ms Billed Duration: 200 ms Memory Size: 128 MB Max Memory Used: 53 MB

13:15:28
START RequestId: 0b6d13ac-f996-4f68-95ce-66f345f9bbc4 Version: $LATEST

13:15:28
Expecting property name: line 10 column 2 (char 206): ValueError Traceback (most recent call last): File "/var/task/imageprocessor.py", line 182, in handler return process_image(event, context) File "/var/task/imageprocessor.py", line 48, in process_image config = load_config() File "/var/task/imageprocessor.py", line 24, in load_config return json.loads(conf_json) File "/usr/l

13:15:28
END RequestId: 0b6d13ac-f996-4f68-95ce-66f345f9bbc4

13:15:28
REPORT RequestId: 0b6d13ac-f996-4f68-95ce-66f345f9bbc4 Duration: 184.41 ms Billed Duration: 200 ms Memory Size: 128 MB Max Memory Used: 54 MB

13:15:30
START RequestId: 0b6d13ac-f996-4f68-95ce-66f345f9bbc4 Version: $LATEST

13:15:30
Expecting property name: line 10 column 2 (char 206): ValueError Traceback (most recent call last): File "/var/task/imageprocessor.py", line 182, in handler return process_image(event, context) File "/var/task/imageprocessor.py", line 48, in process_image config = load_config() File "/var/task/imageprocessor.py", line 24, in load_config return json.loads(conf_json) File "/usr/l

13:15:30
END RequestId: 0b6d13ac-f996-4f68-95ce-66f345f9bbc4

13:15:30
REPORT RequestId: 0b6d13ac-f996-4f68-95ce-66f345f9bbc4 Duration: 176.75 ms Billed Duration: 200 ms Memory Size: 128 MB Max Memory Used: 54 MB

13:15:34
START RequestId: 0b6d13ac-f996-4f68-95ce-66f345f9bbc4 Version: $LATEST

13:15:34
Expecting property name: line 10 column 2 (char 206): ValueError Traceback (most recent call last): File "/var/task/imageprocessor.py", line 182, in handler return process_image(event, context) File "/var/task/imageprocessor.py", line 48, in process_image config = load_config() File "/var/task/imageprocessor.py", line 24, in load_config return json.loads(conf_json) File "/usr/l

13:15:34
END RequestId: 0b6d13ac-f996-4f68-95ce-66f345f9bbc4

videocapture and videocaptureip not working as expected

Hi
I have done all the setup and i am able to see the web UI but when i invoke the videocaptureip['video_url',20] i am not getting any output in Web UI. Is any other settings i have to do. Please mention those steps also. when building stack I am getting CREATE_COMPLETE for overall Stack but for many componets i am seeing CREATE_IN_PROGRESS. Please find the attached image.
stack_build_issue

pynt createstack failed

pynt createstack failed because of Status reason:
The following resource(s) failed to delete: [EnrichedFrameTable] in cloudformation.Help needed.

Cloudwatch LOG

Unable to import module 'imageprocessor': No module named pytz

Sending image to kenisis on an EC2 instance

I'm running this on an EC2 instance and believe that I have everything properly installed. I'm using a MJPEG url to use with videocaptureip. When I run the program it appears as though it is capturing frames, but they are not populating on the web ui.

i.e. it says:
Sending image to Kinesis
{u'ShardId': u'shardId-000000000000', 'ResponseMetadata': {'RetryAttempts': 0, 'HTTPStatusCode': 200, 'RequestId': 'ce3652dd-a3b3-457b-80e8-01084f372dc3', 'HTTPHeaders': {'x-amzn-requestid': 'ce3652dd-a3b3-457b-80e8-01084f372dc3', 'x-amz-id-2': 'tvUJ1BPccjt617BADReelAm0Mw/Q5mK/bn10D+Jv+++dAuC7gE22Ti9/vWrNcOwxR1mM9RioAjcdbfCH5tJVCiH7BUoF1F6y', 'content-length': '110', 'date': 'Thu, 31 May 2018 22:07:51 GMT', 'content-type': 'application/x-amz-json-1.1'}}, u'SequenceNumber': u'49584995657566029379979076055971568312156861850135298050'}

But when I check my s3 bucket and the webui on port 8080, there is nothing there. What could be causing this?

Video takes infinite time to analyze

EDIT it started working now. I want to know is there any limit on how many video we can process. if yes how can i increase this limit?

Hi some time before it was working fine and I was able to analyze videos with in minute or so but suddenly my video is not getting analyze. It just goes on forever. I am trying so search faces in a videos. faces are indexed. they are about 300 face indexed

I am analyzing 3553477.mp4 (only 10 second video)

here is the output

Faces indexed:
  Face ID: a1c8847f-7e80-4dd7-8b51-63c0d22ab765
  Location: {'Width': 0.7492865920066833, 'Height': 0.8562403321266174, 'Left': 0.1664663851261139, 'Top': 0.032046884298324585}
started video analyzing 
Start Job Id: 952741e2adaf526ca8fd270912d2cf578d24b69039edcac05dcc507b7b2193fb
....................
....................
....................
....................
....................
....................
....................
....................
....................
....................
....................
....................
....................
....................
....................
....................
....................
....................
....................
....................
....................
....................
....................
....................
....................
....................
....................
....................
....................
....................
....................
....................
....................
....................
....................
....................
....................
....................

It goes on and does not stop

here is the code

import boto3
import json
import sys


class VideoDetect:
    rek = boto3.client('rekognition')
    queueUrl = 'https://sqs.us-west-2.amazonaws.com/655136467581/Rekoginition'
    roleArn = 'arn:aws:iam::655136467581:role/face_matching'
    topicArn = 'arn:aws:sns:us-west-2:655136467581:image-rekoginition-sns'
    bucket = 'face-reckognition-video-1'
    video = ''

    def __init__(self, video):
        self.video = video

    def main(self):

        jobFound = False
        sqs = boto3.client('sqs')

        # =====================================
        response = self.rek.start_face_search(Video={'S3Object': {'Bucket': self.bucket, 'Name': self.video}},
                                              CollectionId='FaceCollection',
                                              NotificationChannel={'RoleArn': self.roleArn,
                                                                   'SNSTopicArn': self.topicArn})

        # =====================================
        print('Start Job Id: ' + response['JobId'])
        dotLine = 0

        faces = set()
        while not jobFound:
            sqsResponse = sqs.receive_message(QueueUrl=self.queueUrl, MessageAttributeNames=['ALL'],
                                              MaxNumberOfMessages=10)

            if sqsResponse:

                if 'Messages' not in sqsResponse:
                    if dotLine < 20:
                        print('.', end='')
                        dotLine = dotLine + 1
                    else:
                        print()
                        dotLine = 0
                    sys.stdout.flush()
                    continue

                for message in sqsResponse['Messages']:
                    notification = json.loads(message['Body'])
                    rekMessage = json.loads(notification['Message'])
                    print(rekMessage['JobId'])
                    print(rekMessage['Status'])
                    if str(rekMessage['JobId']) == response['JobId']:
                        print('Matching Job Found:' + rekMessage['JobId'])
                        jobFound = True
                        # =============================================
                        f = self.GetResultsFaceSearchCollection(rekMessage['JobId'])

                        faces.update(f)

                        # =============================================

                        sqs.delete_message(QueueUrl=self.queueUrl,
                                           ReceiptHandle=message['ReceiptHandle'])
                    else:
                        print("Job didn't match:" +
                              str(rekMessage['JobId']) + ' : ' + str(response['JobId']))
                    # Delete the unknown message. Consider sending to dead letter queue
                    sqs.delete_message(QueueUrl=self.queueUrl,
                                       ReceiptHandle=message['ReceiptHandle'])

        print('done')

        return faces

    def GetResultsFaceSearchCollection(self, jobId):
        maxResults = 10
        paginationToken = ''
        faces = []
        finished = False

        while not finished:
            response = self.rek.get_face_search(JobId=jobId,
                                                MaxResults=maxResults,
                                                NextToken=paginationToken)
            print(response)
            print(response['VideoMetadata']['Codec'])
            print(str(response['VideoMetadata']['DurationMillis']))
            print(response['VideoMetadata']['Format'])
            print(response['VideoMetadata']['FrameRate'])

            for personMatch in response['Persons']:

                print('Person Index: ' + str(personMatch['Person']['Index']))
                print('Timestamp: ' + str(personMatch['Timestamp']))

                if 'FaceMatches' in personMatch:
                    for faceMatch in personMatch['FaceMatches']:
                        print('Face ID: ' + faceMatch['Face']['FaceId'])
                        faces.append(faceMatch['Face']['FaceId'])
                        print('Similarity: ' + str(faceMatch['Similarity']))
                print()
            if 'NextToken' in response:
                paginationToken = response['NextToken']
            else:
                finished = True
            print()

        return faces

ValidationError

I am getting following error while creating stack.

An error occurred (ValidationError) when calling the DescribeStackResource operation: Resource VidAnalyzerRestApi does not exist for stack video-analyzer-stack @moanany

pynt create stack:

Hi,
i had created my own bucket and deployed lamada .
i had only Amazoncloudformationreadonlyaccess ,so below policy i have added for complete access.
{
"Version": "2012-10-17",
"Statement": [
{
"Sid": "VisualEditor0",
"Effect": "Allow",
"Action": [
"cloudformation:DetectStackResourceDrift",
"cloudformation:EstimateTemplateCost",
"cloudformation:SetStackPolicy",
"cloudformation:DetectStackDrift",
"cloudformation:CreateStack",
"cloudformation:UpdateStack",
"cloudformation:CreateChangeSet",
"cloudformation:ExecuteChangeSet",
"cloudformation:ValidateTemplate",
"cloudformation:DeleteStack",
"cloudformation:ListStacks",
"cloudformation:DescribeStackEvents",
"cloudformation:DescribeStackResource",
"cloudformation:CreateChangeSet",
"cloudformation:DescribeChangeSet",
"cloudformation:ExecuteChangeSet",
"cloudformation:ValidateTemplate"
],
"Resource": "*"
}
]
}

if i am creating a stack i am getting error.please find the below attachment.
image

can you please help me out exactly where i am missing?

Accessing VideoCaptureIP

thanks for this wonderful project @moanany , i hope you can help me out connecting to a ip camera, whenever i tried to access the analyzer via IP camera,i keep getting the same issue, i already checked the URL and it is correct, i have tried it on a browser and works just fine, the configuration camera is set to mjpeg format and im not sure what to do from here. the message that im getting is the next one:

`(cv) Hugos-MacBook-Air:amazon-rekognition-video-analyzer luismora$ pynt videocaptureip["http://user:[email protected]:80/Streaming/Channels/101/httpPreview",30]
[ build.py - Starting task "videocaptureip" ]
Capturing from 'http://user:[email protected]:80/Streaming/Channels/101/httpPreview' at a rate of 1 every 30 frames...
Traceback (most recent call last):
File "/usr/local/Cellar/python/3.7.4/Frameworks/Python.framework/Versions/3.7/lib/python3.7/urllib/request.py", line 1317, in do_open
encode_chunked=req.has_header('Transfer-encoding'))
File "/usr/local/Cellar/python/3.7.4/Frameworks/Python.framework/Versions/3.7/lib/python3.7/http/client.py", line 1244, in request
self._send_request(method, url, body, headers, encode_chunked)
File "/usr/local/Cellar/python/3.7.4/Frameworks/Python.framework/Versions/3.7/lib/python3.7/http/client.py", line 1290, in _send_request
self.endheaders(body, encode_chunked=encode_chunked)
File "/usr/local/Cellar/python/3.7.4/Frameworks/Python.framework/Versions/3.7/lib/python3.7/http/client.py", line 1239, in endheaders
self._send_output(message_body, encode_chunked=encode_chunked)
File "/usr/local/Cellar/python/3.7.4/Frameworks/Python.framework/Versions/3.7/lib/python3.7/http/client.py", line 1026, in _send_output
self.send(msg)
File "/usr/local/Cellar/python/3.7.4/Frameworks/Python.framework/Versions/3.7/lib/python3.7/http/client.py", line 966, in send
self.connect()
File "/usr/local/Cellar/python/3.7.4/Frameworks/Python.framework/Versions/3.7/lib/python3.7/http/client.py", line 938, in connect
(self.host,self.port), self.timeout, self.source_address)
File "/usr/local/Cellar/python/3.7.4/Frameworks/Python.framework/Versions/3.7/lib/python3.7/socket.py", line 707, in create_connection
for res in getaddrinfo(host, port, 0, SOCK_STREAM):
File "/usr/local/Cellar/python/3.7.4/Frameworks/Python.framework/Versions/3.7/lib/python3.7/socket.py", line 748, in getaddrinfo
for res in _socket.getaddrinfo(host, port, family, type, proto, flags):
socket.gaierror: [Errno 8] nodename nor servname provided, or not known

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "video_cap_ipcam.py", line 140, in
main()
File "video_cap_ipcam.py", line 94, in main
stream = urllib.request.urlopen(ip_cam_url)
File "/usr/local/Cellar/python/3.7.4/Frameworks/Python.framework/Versions/3.7/lib/python3.7/urllib/request.py", line 222, in urlopen
return opener.open(url, data, timeout)
File "/usr/local/Cellar/python/3.7.4/Frameworks/Python.framework/Versions/3.7/lib/python3.7/urllib/request.py", line 525, in open
response = self._open(req, data)
File "/usr/local/Cellar/python/3.7.4/Frameworks/Python.framework/Versions/3.7/lib/python3.7/urllib/request.py", line 543, in _open
'_open', req)
File "/usr/local/Cellar/python/3.7.4/Frameworks/Python.framework/Versions/3.7/lib/python3.7/urllib/request.py", line 503, in _call_chain
result = func(*args)
File "/usr/local/Cellar/python/3.7.4/Frameworks/Python.framework/Versions/3.7/lib/python3.7/urllib/request.py", line 1345, in http_open
return self.do_open(http.client.HTTPConnection, req)
File "/usr/local/Cellar/python/3.7.4/Frameworks/Python.framework/Versions/3.7/lib/python3.7/urllib/request.py", line 1319, in do_open
raise URLError(err)
urllib.error.URLError: <urlopen error [Errno 8] nodename nor servname provided, or not known>
[ build.py - Completed task "videocaptureip" ]
`

the project is build on python 3,i did convert the files so it can be compatible #50
if a run it from the computers built in camera it works perfectly fine.

CF Template is giving problems

It went well for initial steps.But If I am using pynt createstack the stack is going to ROLLBACK_FAILED state and not finishing the remaing steps.And its showing rollback reason as Status reason:
The following resource(s) failed to delete: [EnrichedFrameTable].

deploylambda build script fails if region is "us-east-1" and S3 bucket doesn't exist

If the S3 bucket used as a deployment target does not exist, the deploylambda build script attempts to create it by calling the create_bucket() Boto3 API specifying a LocationConstraint set to the region name of the current AWS CLI profile.

Boto3 generates an InvalidLocationConstraint exception if the region specified as an argument is us-east-1 (see boto/boto3#125).

Issue originally reported by Jenil Shah as a comment on the blog post:

https://aws.amazon.com/blogs/ai/create-a-serverless-solution-for-video-frame-analysis-and-alerting/

localhost:8080 page is static

I completed all the build steps successfully on macOS 10.13.1.

webui is running:

[ build.pyc - Starting task "webuiserver" ]
Starting local Web UI Server in directory 'build/web-ui/' on port 8080
127.0.0.1 - - [14/Dec/2017 09:08:31] "GET / HTTP/1.1" 200 -
127.0.0.1 - - [14/Dec/2017 09:08:31] "GET /src/app.css HTTP/1.1" 200 -
127.0.0.1 - - [14/Dec/2017 09:08:31] "GET /src/js/axios.js HTTP/1.1" 200 -
127.0.0.1 - - [14/Dec/2017 09:08:31] "GET /src/js/vue.js HTTP/1.1" 200 -
127.0.0.1 - - [14/Dec/2017 09:08:31] "GET /logo.png HTTP/1.1" 200 -
127.0.0.1 - - [14/Dec/2017 09:08:31] "GET /src/apigw.js HTTP/1.1" 200 -
127.0.0.1 - - [14/Dec/2017 09:08:31] "GET /src/app.js HTTP/1.1" 200 -
127.0.0.1 - - [14/Dec/2017 09:08:32] "GET /favicon-16x16.png HTTP/1.1" 200 -
127.0.0.1 - - [14/Dec/2017 09:08:32] "GET /favicon-32x32.png HTTP/1.1" 200 -
127.0.0.1 - - [14/Dec/2017 09:08:32] "GET /favicon-96x96.png HTTP/1.1" 200 -
127.0.0.1 - - [14/Dec/2017 09:08:42] "GET / HTTP/1.1" 200 -
127.0.0.1 - - [14/Dec/2017 09:08:44] "GET / HTTP/1.1" 200 -
127.0.0.1 - - [14/Dec/2017 09:08:45] "GET / HTTP/1.1" 200 -
127.0.0.1 - - [14/Dec/2017 09:10:59] "GET / HTTP/1.1" 200 -
127.0.0.1 - - [14/Dec/2017 09:10:59] "GET /src/apigw.js HTTP/1.1" 200 -
127.0.0.1 - - [14/Dec/2017 09:11:07] "GET / HTTP/1.1" 200 -
127.0.0.1 - - [14/Dec/2017 09:11:07] "GET /src/app.css HTTP/1.1" 200 -
127.0.0.1 - - [14/Dec/2017 09:11:07] "GET /src/js/axios.js HTTP/1.1" 200 -
127.0.0.1 - - [14/Dec/2017 09:11:07] "GET /src/js/vue.js HTTP/1.1" 200 -
127.0.0.1 - - [14/Dec/2017 09:11:07] "GET /logo.png HTTP/1.1" 200 -
127.0.0.1 - - [14/Dec/2017 09:11:07] "GET /src/apigw.js HTTP/1.1" 200 -
127.0.0.1 - - [14/Dec/2017 09:11:07] "GET /src/app.js HTTP/1.1" 200 -
127.0.0.1 - - [14/Dec/2017 09:11:08] "GET /favicon-96x96.png HTTP/1.1" 200 -
127.0.0.1 - - [14/Dec/2017 09:11:08] "GET /favicon-32x32.png HTTP/1.1" 200 -
127.0.0.1 - - [14/Dec/2017 09:11:08] "GET /favicon-16x16.png HTTP/1.1" 200 -
127.0.0.1 - - [14/Dec/2017 09:11:13] "GET / HTTP/1.1" 200 -
127.0.0.1 - - [14/Dec/2017 09:11:14] "GET / HTTP/1.1" 200 -

videocapture[20] is returning output.

But the http://localhost:8080 page is static and the dotted box contains no output.

What could be going wrong?

Thanks!

Unable to access CCTV IP camera

Hi,
I have cloned amazon-rekognition-video-analyzer and installed all the prerequisite software's, got IAM user to access all necessary AWS services.

After setting the environment , I have configured the code and executed.

The amazon-rekognition-video-analyzer is working very fine with my in-build camera when i run the following command
> pynt videocapture[20]

But Iam unable to access the CCTV IP camera. The CCTV IP Camera has credentials too.
I have tried following commands, But not sending the video to kinesis stream.

> pynt videocaptureip["12..*.161", 20]** , as it have credentials I have also tried

pynt videocaptureip["http://username:password@12.**..161", 20]
But not working
In capturing terminal it shows Capturing but not streaming to Kinesis service.
I have also tried by accessing a camera connected to the same network by providing it's IP. Iam able to ping. But it's raising I/O error.

Kindly help me to access the CCTV IP Camera with credentials.

Where do Lambda Functions print to?

I'm curious to see the content of the Rekognition JSON response. I've noticed that there are a few print statements in imageprocessor.py--where do these print to? For example line 146:
print("Successfully published alert message to SNS.")
Where can I see this output?

If I know the location, I can simply print out the contents of the Rekognition response.

Realtime Analysis

How do I get realtime analytics of video frames on web UI and DynamoDB table?

Invalid parameter: TopicArn Reason: An ARN must have at least 6 elements, not 1

I successfully built the entire project and run several times and it worked on an ipcam. Then, I started to insert some elements in the code to time the differents stages and now the video flux doesn't show up in the web ui.

I have checked the logs of lambda functions, and the bug seems to come from imageprocessor. Indeed, this is what I get when i run the script on my built-in webcam :

 07:18:01 On 09/19/18, 9:18 AM CEST...
 07:18:01 - "Human" was detected with 98.52% confidence.
 07:18:02 An error occurred (InvalidParameter) when calling the Publish operation: Invalid parameter: TopicArn Reason: An ARN must have at least 6 elements, not 1: InvalidParameterException Traceback (most recent call last): File "/var/task/imageprocessor.py", line 176, in handler return process_image(event, context) File "/var/task/imageprocessor.py", line 138, in process_image "labels": labels
 07:18:02 END RequestId: a33af59c...

So I tried to remove the phone number and arn topic in the image-processor-params.json, rebuild the entire project multiple times (deletedata, package lambda, deploylambda, updatestack, webui, webuiserver), tried also updatelambda command but it still doesn't work and I don't understand why.

Please help!

Stuck in the createstack

Well, I have done everything I can possible think off, if anyone can help I really appreciate.
pynt createstack
[ build.pyc - Starting task "createstack" ]
[ build.pyc - Error in task "createstack" ]
[ build.pyc - Aborting build ]
Traceback (most recent call last):
File "/usr/bin/pynt", line 11, in
load_entry_point('pynt==0.8.2', 'console_scripts', 'pynt')()
File "/usr/lib/python2.7/dist-packages/pynt/_pynt.py", line 298, in main
build(sys.argv[1:])
File "/usr/lib/python2.7/dist-packages/pynt/_pynt.py", line 59, in build
_run_from_task_names(module,args.tasks)
File "/usr/lib/python2.7/dist-packages/pynt/_pynt.py", line 109, in _run_from_task_names
_run(module, logger, task, completed_tasks, True, args, kwargs)
File "/usr/lib/python2.7/dist-packages/pynt/_pynt.py", line 180, in _run
task(*(args or []),**(kwargs or {}))
File "/usr/lib/python2.7/dist-packages/pynt/_pynt.py", line 245, in call
self.func.call(*args,**kwargs)
File "build.py", line 156, in createstack
stack_name = global_params_dict["StackName"]

createstack error

Getting stack ROLLBACK_COMPLETE status.

[ build.pyc - Error in task "createstack" ]
[ build.pyc - Aborting build ]
Traceback (most recent call last):
File "/usr/local/bin/pynt", line 9, in
load_entry_point('pynt==0.8.1', 'console_scripts', 'pynt')()
File "/usr/local/lib/python2.7/dist-packages/pynt/_pynt.py", line 295, in main
build(sys.argv[1:])
File "/usr/local/lib/python2.7/dist-packages/pynt/_pynt.py", line 59, in build
_run_from_task_names(module,args.tasks)
File "/usr/local/lib/python2.7/dist-packages/pynt/_pynt.py", line 109, in _run_from_task_names
_run(module, logger, task, completed_tasks, True, args, kwargs)
File "/usr/local/lib/python2.7/dist-packages/pynt/_pynt.py", line 180, in _run
task(*(args or []),**(kwargs or {}))
File "/usr/local/lib/python2.7/dist-packages/pynt/_pynt.py", line 242, in call
self.func.call(*args,**kwargs)
File "build.py", line 184, in createstack
cfn_stack_delete_waiter.wait(StackName=stack_name)
File "/usr/local/lib/python2.7/dist-packages/botocore/waiter.py", line 53, in wait
Waiter.wait(self, **kwargs)
File "/usr/local/lib/python2.7/dist-packages/botocore/waiter.py", line 323, in wait
last_response=response,
botocore.exceptions.WaiterError: Waiter StackCreateComplete failed: Waiter encountered a terminal failure state

Raspberry pi Camera

My project is to run a Raspberry Pi camera as a slave to other devices already in place for an experiment. Once the camera is armed, it will continuously record a circular stream of video in memory. When a digital trigger is received, the video will begin being saved to disk. In addition to saving the video after a trigger, the video before the trigger will also be saved. So basically the condition of master slave concept where checking the masters output that had to be high to trigger the slaves input without any delay.So can someone help me out to code to the above condition asap?

pynt createstack throwing error

This is the error I am getting

(aws) vi@vi-Vostro-3558:/project/amazon-rekognition-video-analyzer:anaconda2-5.0.1$ pynt createstack
[ build.pyc - Starting task "createstack" ]
Attempting to CREATE 'video-analyzer-stack' stack using CloudFormation.
Waiting until 'video-analyzer-stack' stack status is CREATE_COMPLETE
[ build.pyc - Error in task "createstack" ]
[ build.pyc - Aborting build ]
Traceback (most recent call last):
  File "/pkg/anaconda2-5.0.1/bin/pynt", line 11, in <module>
    sys.exit(main())
  File "/pkg/anaconda2-5.0.1/lib/python2.7/site-packages/pynt/_pynt.py", line 295, in main
    build(sys.argv[1:])
  File "/pkg/anaconda2-5.0.1/lib/python2.7/site-packages/pynt/_pynt.py", line 59, in build
    _run_from_task_names(module,args.tasks)
  File "/pkg/anaconda2-5.0.1/lib/python2.7/site-packages/pynt/_pynt.py", line 109, in _run_from_task_names
    _run(module, logger, task, completed_tasks, True, args, kwargs)
  File "/pkg/anaconda2-5.0.1/lib/python2.7/site-packages/pynt/_pynt.py", line 180, in _run
    task(*(args or []),**(kwargs or {}))
  File "/pkg/anaconda2-5.0.1/lib/python2.7/site-packages/pynt/_pynt.py", line 242, in __call__
    self.func.__call__(*args,**kwargs)
  File "build.py", line 184, in createstack
    cfn_stack_delete_waiter.wait(StackName=stack_name)
  File "/pkg/anaconda2-5.0.1/lib/python2.7/site-packages/botocore/waiter.py", line 53, in wait
    Waiter.wait(self, **kwargs)
  File "/pkg/anaconda2-5.0.1/lib/python2.7/site-packages/botocore/waiter.py", line 323, in wait
    last_response=response,
botocore.exceptions.WaiterError: Waiter StackCreateComplete failed: Waiter encountered a terminal failure state

Would appreciate any help on this. Thanks.

Speeding up processing

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?

deploylambda error: Invalid stage identifier specified

Hi,

I got an error while deploying my CloudFormation Script.

botocore.exceptions.WaiterError: Waiter StackCreateComplete failed: Waiter encountered a terminal failure state

The Issue is somewhere around the VidAnalyzerApiKey scope, because I got this error:
CREATE_FAILED | AWS::ApiGateway::ApiKey | VidAnalyzerApiKey | Invalid stage identifier specified

Any ideas on this?
screen shot 2018-04-24 at 14 15 10

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.