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
All works (after some modification), except viewing image frames #57
Thank you @moanany for creating this example. There is a lot going on in it!
I think I have a similar problem to that in issue #55 (though their description is brief, so I can't be sure). That is that images are not obtained from the S3 bucket and put into the web UI frames, to the left of the "Detected objects" section (in the div with a class of container-img).
To get this working I firstly had to avoid using the commands pynt videocaptureip[ip_address,30] or pynt videocapture[30], as those led to errors of No module named 'boto3' and No module named 'cv2', respectively, despite running them as described in the instructions (with both of the boto3 and cv2 libraries installed, and tested as working).
Instead, I had to run the Python scripts directly, using py client\video_cap_ipcam.py ip_address 30 or py client\video_cap.py 30 (from the root directory of the project). That worked to acquire images from an IP camera or USB/internal webcam, respectively, without the library-related errors that the pynt commands gave me.
The other pynt commands worked fine for me (well, there are occasional errors, but if they are re-run or some offending item like a rolled back stack is manually deleted, they work fine).
Secondly, once one or the other camera was sending images to Kinesis, another error appeared to be causing the images not to show in the web UI frames. The easiest way to see the error appeared to be to (try and) open the (broken link) image in a new tab (using right-click, Open image in new tab, in Chrome or similar). That showed the full request (URL + extras) used to try and obtain the image (in the address bar) and an XML error in the body of the page, something like:
`AuthorizationQueryParametersError
X-Amz-Expires must be less than a week (in seconds); that is, the given X-Amz-Expires must be less than 604800 secondsD66...5D7erwJSN/UdHX...YR9e/Ek=
`
The error there was due to the code in the file config\framefetcher-params.json (as downloaded from this GitHub repository) containing a value of 2419200 seconds (28 days), for the parameter named s3_pre_signed_url_expiry. If that was set to, say 3600, (or the 1800 that was mentioned in the readme file, but not set in the code), then the error went away. It was replaced, for me, with another error, though.
After replacing the value as described above, the images still did not download, but now gave error messages of the following form (when the image was "opened" in a new tab):
`SignatureDoesNotMatch
The request signature we calculated does not match the signature you provided. Check your key and signing method.ASIA2X...W4OYGAWS4-HMAC-SHA256 20200914T151022Z 20200914/eu-west-2/s3/aws4_request b3aa8136ff77a983...1377818f5eaa2eb1814d...76d38141 57 53 34 2d ... 32 65 62GET /frames/2020/09/14/16/6006d86b-cfb1-439f-ae0c-9c8d9849406b.jpg X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=ASIA2X...W4OYG%2F20200914%2Feu-west-2%2Fs3%2Faws4_request&X-Amz-Date=20200914T151022Z&X-Amz-Expires=86400&X-Amz-Security-Token=IQoJ...37PLLC&X-Amz-SignedHeaders=host host:cam-project-video-frames-001.s3.eu-west-2.amazonaws.com host UNSIGNED-PAYLOAD47 45 54 0a 2f ... 41 59 4c 4f 41 448314...1FED55O1ifrW...KO53Ftr+nU=
`
I have put in ellipses (...) above where parts are long and/or may be security issues.
So that seems that the signature might not be created properly (or some similar reason). Everything else but this works, though, so I don't think the security credentials (set when running aws configure in the AWS CLI) can be wrong, except perhaps that the credentials shown in the error message above are temporary security credentials (if I understand what is going on), as the AWSAccessKeyId given above differs from that used for the user I was working with in my AWS account (and set when running aws configure).
I have been looking at this for days, now (I'm new to these technologies and languages), and not got to the bottom of what might be causing the issue in downloading these images from the S3 bucket.
Any help or advice would be very gratefully received.
Thank you @moanany for creating this example. There is a lot going on in it!
I think I have a similar problem to that in issue #55 (though their description is brief, so I can't be sure). That is that images are not obtained from the S3 bucket and put into the web UI frames, to the left of the "Detected objects" section (in the
div
with aclass
ofcontainer-img
).To get this working I firstly had to avoid using the commands
pynt videocaptureip[ip_address,30]
orpynt videocapture[30]
, as those led to errors ofNo module named 'boto3'
andNo module named 'cv2'
, respectively, despite running them as described in the instructions (with both of the boto3 and cv2 libraries installed, and tested as working).Instead, I had to run the Python scripts directly, using
py client\video_cap_ipcam.py ip_address 30
orpy client\video_cap.py 30
(from the root directory of the project). That worked to acquire images from an IP camera or USB/internal webcam, respectively, without the library-related errors that thepynt
commands gave me.The other
pynt
commands worked fine for me (well, there are occasional errors, but if they are re-run or some offending item like a rolled back stack is manually deleted, they work fine).Secondly, once one or the other camera was sending images to Kinesis, another error appeared to be causing the images not to show in the web UI frames. The easiest way to see the error appeared to be to (try and) open the (broken link) image in a new tab (using right-click,
Open image in new tab
, in Chrome or similar). That showed the full request (URL + extras) used to try and obtain the image (in the address bar) and an XML error in the body of the page, something like:`
AuthorizationQueryParametersError
`
The error there was due to the code in the file
config\framefetcher-params.json
(as downloaded from this GitHub repository) containing a value of 2419200 seconds (28 days), for the parameter nameds3_pre_signed_url_expiry
. If that was set to, say 3600, (or the 1800 that was mentioned in the readme file, but not set in the code), then the error went away. It was replaced, for me, with another error, though.After replacing the value as described above, the images still did not download, but now gave error messages of the following form (when the image was "opened" in a new tab):
`
SignatureDoesNotMatch
`
I have put in ellipses (...) above where parts are long and/or may be security issues.
So that seems that the signature might not be created properly (or some similar reason). Everything else but this works, though, so I don't think the security credentials (set when running
aws configure
in the AWS CLI) can be wrong, except perhaps that the credentials shown in the error message above are temporary security credentials (if I understand what is going on), as theAWSAccessKeyId
given above differs from that used for the user I was working with in my AWS account (and set when runningaws configure
).I have been looking at this for days, now (I'm new to these technologies and languages), and not got to the bottom of what might be causing the issue in downloading these images from the S3 bucket.
Any help or advice would be very gratefully received.