GithubHelp home page GithubHelp logo

dataplayer12 / homesecurity Goto Github PK

View Code? Open in Web Editor NEW
170.0 12.0 51.0 97.12 MB

Security camera with Raspberry pi and NVIDIA Jetson platforms

License: MIT License

Python 97.46% Shell 2.54%
raspberry-pi-3 raspberry-pi-zero jetson-nano jetson-tx2 opencv-python deep-learning object-detection jetson-xavier edge-computing

homesecurity's People

Contributors

bdherouville avatar dataplayer12 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

homesecurity's Issues

TensorFlow Error

Hi, thanks for the great work!
Any idea why this error occurred? (i had installed tensorflow)
hserror

Missing tensorflow file

Looks like the model is missing.

File "jetsontx2/tx2_surveillance.py", line 150, in
main()
File "jetsontx2/tx2_surveillance.py", line 125, in main
trt_graph = load_trt_pb(pb_path)
File "/home/vondalej/homesecurity/jetsontx2/utils/od_utils.py", line 28, in load_trt_pb
trt_graph_def.ParseFromString(pf.read())
File "/usr/local/lib/python3.6/dist-packages/tensorflow_core/python/lib/io/file_io.py", line 122, in read
self._preread_check()
File "/usr/local/lib/python3.6/dist-packages/tensorflow_core/python/lib/io/file_io.py", line 84, in _preread_check
compat.as_bytes(self.__name), 1024 * 512)
tensorflow.python.framework.errors_impl.NotFoundError: ./human_detection/ssd_mobilenet_v1_coco_trt.pb; No such file or directory
FATAL: exception not rethrown

ModuleNotFoundError: No module named 'tensorflow.contrib'

Hello
I keep getting following error.
Any help would be appreciated.
Thanks

jetson@chung-jetson:/media/jetson/EXTDR/homesecurity$ python3 jetsontx2/compile_ssd_mobilenet.py
2020-09-09 12:52:44.261984: I tensorflow/stream_executor/platform/default/dso_loader.cc:48] Successfully opened dynamic library libcudart.so.10.2
Traceback (most recent call last):
File "jetsontx2/compile_ssd_mobilenet.py", line 1, in
import tensorflow.contrib.tensorrt as trt
ModuleNotFoundError: No module named 'tensorflow.contrib'

Change from person detection to car detection

Would changing line 33 of human_detect.py from detection_classes:0 to detection_classes:2 detect cars instead of people? Thank you.

COCO Classes
1 | person | person | person | person
2 | bicycle | bicycle | bicycle | vehicle
3 | car | car | car | vehicle

Saving Images

I've been messing around with this function for the tx2 branch. I'd like it to save a screenshot of the image when it detects a person. I've tried a few methods and failed.

I did notice that the window has a built in save UI. I've tried using a keyboard function to open and save, but it's clumsy and doesn't always work.

Can that save function be called via script and better yet use a timestamp?

tx2_surveillance.py core dumped

Not even sure where the error is in here. I will say the process took all 4GB of RAM and 6 Gigs of swap while running.

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "jetsontx2/tx2_surveillance.py", line 150, in
main()
File "jetsontx2/tx2_surveillance.py", line 135, in main
, , _ = detect(dummy_img, tf_sess, conf_th=.3, od_type=od_type)
File "/home/vondalej/homesecurity/jetsontx2/utils/od_utils.py", line 87, in detect
feed_dict={tf_input: img[None, ...]})
File "/usr/local/lib/python3.6/dist-packages/tensorflow_core/python/client/session.py", line 956, in run
run_metadata_ptr)
File "/usr/local/lib/python3.6/dist-packages/tensorflow_core/python/client/session.py", line 1180, in run
feed_dict_tensor, options, run_metadata)
File "/usr/local/lib/python3.6/dist-packages/tensorflow_core/python/client/session.py", line 1359, in do_run
run_metadata)
File "/usr/local/lib/python3.6/dist-packages/tensorflow_core/python/client/session.py", line 1384, in do_call
raise type(e)(node_def, op, message)
tensorflow.python.framework.errors_impl.InvalidArgumentError: Cannot assign a device for operation Postprocessor/BatchMultiClassNonMaxSuppression/TRTEngineOp_1: Could not satisfy explicit device specification '/device:CPU:0' because no supported kernel for CPU devices is available.
Colocation Debug Info:
Colocation group had the following types and supported devices:
Root Member(assigned_device_name_index
=-1 requested_device_name
='/device:CPU:0' assigned_device_name
='' resource_device_name
='' supported_device_types
=[GPU] possible_devices_=[]
TRTEngineOp: GPU

Colocation members, user-requested devices, and framework assigned devices, if any:
Postprocessor/BatchMultiClassNonMaxSuppression/TRTEngineOp_1 (TRTEngineOp) /device:CPU:0

Op: TRTEngineOp
Node attrs: use_calibration=false, fixed_input_size=true, input_shapes=[], OutT=[DT_FLOAT, DT_FLOAT, DT_FLOAT, DT_FLOAT, DT_FLOAT, ..., DT_FLOAT, DT_FLOAT, DT_FLOAT, DT_FLOAT, DT_FLOAT], precision_mode="FP16", static_engine=true, serialized_segment="ptrta\000...00\000\000", cached_engine_batches=[], InT=[DT_FLOAT], calibration_data="", output_shapes=[], workspace_size_bytes=7965653, max_cached_engines_count=1, segment_func=Postprocessor/BatchMultiClassNonMaxSuppression/TRTEngineOp_1_native_segment[], segment_funcdef_name=""
Registered kernels:
device='GPU'

 [[node Postprocessor/BatchMultiClassNonMaxSuppression/TRTEngineOp_1 (defined at /usr/local/lib/python3.6/dist-packages/tensorflow_core/python/framework/ops.py:1748) ]]

Original stack trace for 'Postprocessor/BatchMultiClassNonMaxSuppression/TRTEngineOp_1':
File "jetsontx2/tx2_surveillance.py", line 150, in
main()
File "jetsontx2/tx2_surveillance.py", line 125, in main
trt_graph = load_trt_pb(pb_path)
File "/home/vondalej/homesecurity/jetsontx2/utils/od_utils.py", line 38, in load_trt_pb
tf.import_graph_def(trt_graph_def, name='')
File "/usr/local/lib/python3.6/dist-packages/tensorflow_core/python/util/deprecation.py", line 513, in new_func
return func(*args, **kwargs)
File "/usr/local/lib/python3.6/dist-packages/tensorflow_core/python/framework/importer.py", line 405, in import_graph_def
producer_op_list=producer_op_list)
File "/usr/local/lib/python3.6/dist-packages/tensorflow_core/python/framework/importer.py", line 517, in _import_graph_def_internal
_ProcessNewOps(graph)
File "/usr/local/lib/python3.6/dist-packages/tensorflow_core/python/framework/importer.py", line 243, in _ProcessNewOps
for new_op in graph._add_new_tf_operations(compute_devices=False): # pylint: disable=protected-access
File "/usr/local/lib/python3.6/dist-packages/tensorflow_core/python/framework/ops.py", line 3561, in _add_new_tf_operations
for c_op in c_api_util.new_tf_operations(self)
File "/usr/local/lib/python3.6/dist-packages/tensorflow_core/python/framework/ops.py", line 3561, in
for c_op in c_api_util.new_tf_operations(self)
File "/usr/local/lib/python3.6/dist-packages/tensorflow_core/python/framework/ops.py", line 3451, in _create_op_from_tf_operation
ret = Operation(c_op, self)
File "/usr/local/lib/python3.6/dist-packages/tensorflow_core/python/framework/ops.py", line 1748, in init
self._traceback = tf_stack.extract_stack()

terminate called without an active exception
terminate called recursively
./launch.sh: line 43: 18873 Aborted (core dumped) python3 jetsontx2/tx2_surveillance.py

Opencv4.5.0

Hi, I was thinking to use OpenCV 4.5.0 on both pi and jetson, what do you suggest? have you tried it?

Which JetPack Version for Xavier

Hi. I am running JetPack version 4.2.1 on my Xavier. When I run launch.sh, xavier_surveillance.py fails on multiple libraries as they are too new plus the CUDA is not 10.0. What JetPack load did you successfully test with? TIA.

Failed library versions:

  • libopencv_highgui
  • libopencv_videoio
  • libopencv_imgcodecs
  • libopencv_imgproc
  • libopencv_imgcodecs
  • libopencv_imgproc
  • libopencv_core
  • libcudart
  • libcublas
  • libcurand
  • libcudnn

Renamed the libraries for fun and received a core dump.

Which JetPack and TF Version?

Hi. Great project. As I work through errors running on Nano withJetPack 4.3, I am finding that your project requires tensorflow<2 and CUDA=10.0. Is that correct? Which JetPack version and TF version did you use successfully with your project? TIA.

Please Add instructions for compiling SSD Mobilenet

It is expected that your Jetson TX2 already has numpy and opencv installed. Install the official tensorflow release for Jetson TX2 by following the instructions from here. You may also have to compile the MobileNet SSD model for your version of tensorflow and JetPack.

//TODO: Add instructions for compiling SSD Mobilenet

Disable cameras on demand

Would like to be able to disable 1 or more of the 4 cameras on demand. Sometimes cameras don't come in groups of 4. Would be nice to comment out one of the URL's and have it ignore that camera.

Tf error

~/homesecurity$ bash launch.sh bash: launch.sh#!/bin/bash: No such file or directory Traceback (most recent call last): File "jetsonano/securitycamnano.py", line 11, in from file_managernano import FileManagerThread, FileCleanerThread, counter File "/home/flaryx32/homesecurity/jetsonano/file_managernano.py", line 6, in import human_detect as hd File "/home/flaryx32/homesecurity/human_detection/human_detect.py", line 63, in odapi = DetectorAPI(path_to_ckpt=model_path) File "/home/flaryx32/homesecurity/human_detection/human_detect.py", line 17, in init od_graph_def = tf.GraphDef() AttributeError: module 'tensorflow' has no attribute 'GraphDef'

Tensorflow Model issue

Ran the launch bash, got this.

File "jetsontx2/tx2_surveillance.py", line 150, in
main()
File "jetsontx2/tx2_surveillance.py", line 125, in main
trt_graph = load_trt_pb(pb_path)
File "/home/vondalej/homesecurity/jetsontx2/utils/od_utils.py", line 28, in load_trt_pb
trt_graph_def.ParseFromString(pf.read())
File "/usr/local/lib/python3.6/dist-packages/tensorflow_core/python/lib/io/file_io.py", line 122, in read
self._preread_check()
File "/usr/local/lib/python3.6/dist-packages/tensorflow_core/python/lib/io/file_io.py", line 84, in _preread_check
compat.as_bytes(self.__name), 1024 * 512)
tensorflow.python.framework.errors_impl.NotFoundError: ./human_detection/ssd_mobilenet_v1_coco_trt.pb; No such file or directory
FATAL: exception not rethrown

Noticed that there is another script to run to compile it. When I ran that I got this...

Traceback (most recent call last):
File "jetsontx2/compile_ssd_mobilenet.py", line 2, in
from tf_trt_models.detection import build_detection_graph
ModuleNotFoundError: No module named 'tf_trt_models'

Extracting bounding box coordinates

When the program determines an object, confidence and then box location it can print this.

[67] [0.48267296] [[361 4 715 937]]

I need to extract the 361 and 4 to help determine which of the 4 boxes it is in. Any ideas on how this could be achieved? I've cheated a bit with the confidence by using any or all on my if statement, but I can't do that with the box.

Understand your code.

Hello,

I was reading about your project which I really like, I am a computer science student and I enjoy creating things with IoT devices especially the Pi, however I never used the Jetson before or anything related to neural network or machine learning. I feel like your project would help me learn how I can use that, I would appreciate if you can get me up to speed on your files structure so I understand what each file does and if you can provide me with some comments, that would be so much appreciated

IP cameras instead of pi's?

Are you able to use existing IP cameras instead of the RPI setup? Also where is the setup details for the Jetson TX2 i.e where do I specify the IP addresses of the cameras?

Running launch.sh and returning errors in logs

I have been installing and updating dependencies on my rasberry pi, when I run the project ($ ./launch.sh), I get the following messages in the log file. Can you please share ideas on how to resolve? Thanks in advance

`2020-11-28 20:46:43.196164: E tensorflow/core/platform/hadoop/hadoop_file_system.cc:132] HadoopFileSystem load error: libhdfs.so: cannot open shared object file: No such file or directory

Traceback (most recent call last):

File "raspi3/securitycam.py", line 10, in
from file_manager import FileManagerThread, FileCleanerThread, counter

File "/home/pi/projects/homesecurity/raspi3/file_manager.py", line 6, in
import human_detect as hd

File "/home/pi/projects/homesecurity/raspi3/human_detect.py", line 62, in
odapi = DetectorAPI(path_to_ckpt=model_path)

File "/home/pi/projects/homesecurity/raspi3/human_detect.py", line 18, in init
serialized_graph = fid.read()

File "/home/pi/.local/lib/python3.7/site-packages/tensorflow_core/python/lib/io/file_io.py", line 122, in read
self._preread_check()

File "/home/pi/.local/lib/python3.7/site-packages/tensorflow_core/python/lib/io/file_io.py", line 84, in _preread_check
compat.as_bytes(self.__name), 1024 * 512)
tensorflow.python.framework.errors_impl.NotFoundError: ssd_mobilenet_v1_coco_2017_11_17/frozen_inference_graph.pb; No such file or directory`

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.