{ "info": { "author": "Castle Guarders", "author_email": "castleguarders@gmail.com", "bugtrack_url": null, "classifiers": [ "License :: OSI Approved :: MIT License", "Operating System :: OS Independent", "Programming Language :: Python :: 3", "Topic :: Multimedia :: Video", "Topic :: Multimedia :: Video :: Capture", "Topic :: Security" ], "description": "=====\nCamAI\n=====\nCamAi takes an AI first approach to monitoring and description of a video stream. Traditional open source packages like ZoneMinder and others largely rely on motion detection and handcrafted \"zones\" to try to reduce false detections. Modern Cameras support much higher resolutions (FHD, 4MP, 5MP, 4K etc) and this requires consistently low latency handling of the video streams, which the older systems seem to be having issues coping with. \n\nCamAi tries to take advantange of the 'many cpu cores' and is heavily threaded to ensure reliable high resolution video stream processing of 'many' sources. It also uses more modern approaches like Instance Segmentation, Face Detection and Face Recognition to reduce the false alarm rates. While this requires a GPU/s to get reasonable performance, inference engines bundled with traditional cpu cores are the future. It takes a data science approach to enable learning over time what might be normal or otherwise and get closer to a human in taking actions. Some of these features are available in the \"cloud\" cameras like Ring :sup:`tm`;, Nest :sup:`tm`;, which requires the video streams to be sent to 'their' cloud, and come with many involuntary 'sharing' features. CamAi can do this all within the network, with or without any external connectivity for the camera streams. \n\nIt is certainly possible to try to 'graft' these features to existing systems. However it would have resulted in a mish mash of languages and technologies (perl/c++/windows only) or only partially open source. CamAI aims to have a more modern, maintainable and extensible code base that is fully be open source, and cross platform (over time) and modern, without having to jettison control and visibility to 'cloud' cameras.\n\n\n============\nInstallation\n============\n\nRequirements\n------------\n\nThe development has been primarily on a ubuntu 18.04 base. \n\nInstall Ubuntu Packages in ubuntu_deps.txt.\n bash ./ubuntu-deps.txt\n\nInstall Nvidia CUDA for tensorflow acceleration\n Cuda 10.0(not 10.1), CuDNN 7.5 and Tensorflow 1.13/1.14 was used for testing\n Any compatible combination after these versions should work.\n\n It's possible to run tensorflow without CUDA, but it will most likely be impractically slow. If you use CamAi in record only mode, a GPU will not be essential.\n\nInstall Pip3 packages in requirements.txt\n Optional but Recommended: Create a virtual env for camai\n mkdir camai\n # If you do not have virtualenv already, or want to use a more current version\n pip3 install virtualenv --user\n virtualenv -p python3.7 venv37\n\n Unpack CamAi\n tar xvfz - camai.tgz (from tar bundle)\n pip3 install ./camai.whl (from a local wheel, pypi has size limits) \n\n\n Install required python packages\n pip3 install -r ./CamAi/requirements.txt\n\nQuick Run\n Discover onvif compatible cameras on your network and generate a configuration file\n\n ./CamAi/camaicli.py discover\n or if installed from a wheel\n python3.7 ~/venv37/lib/python3.7/site-packages/CamAi/camaicli.py discover \n\n Start monitoring with \n ./CamAi/camaicli.py monitor \n or if installed from a wheel\n python3.7 ~/venv37/lib/python3.7/site-packages/CamAi/camaicli.py monitor\n\n If you want to specify a configuration file in a different location you can add --config config.toml to the above\n python3.7 ~/venv37/lib/python3.7/site-packages/CamAi/camaicli.py monitor\n\n This should start logging videos to storage directories you specified in the config file.\n You cannot open the video being currently logged till it's rotated. Default rotation is 30 minutes at hourly boundaries, so you should be able to open it after next hours starts. Alert images and snippet videos are generated in realtime and are located at the base directory for viewing.\n\n\n==============\nConfiguration\n==============\nBelow is an example configuration file that the camcli.py --discover option generates. The configuration file can be hand crafted. There are three main sections.\n\n**Cameras**\n There has to be one or more camera sections. This section contains camera specific configuration and policy information. The camera section consists of a main section and a sub section. The sub section is used to specify one or more objects of interest for this camera and the object specific settings.\n\n**Email Section**\n This contains one Email Sender and zero or more Email Recepient sections\n\n**Manager Section**\n This section has CamAi runtime defaults. If the user doesn't specify a per camera directory, the manager sections basedir variable is used as the parent for each camera.::\n\n [[camera]]\n hostname = \"192.168.2.10\" <--- Largely ceremonial (Not mandatory)\n port = 8000 <--- Onvif port (Not mandatory)\n username = \"admin\" <--- Not used yet, earlier versions used this to construct the URL\n password = \"blahblah\" <--- Not used yet, earlier versions used this to construct the URL\n name = \"Garage Walkway\" <--- Make this human consumable as it shows up in alerts/logs etc (Required)\n url = \"rtsp://admin:blahblah@192.168.1.10:554/h264Preview_01_main\" (Required)\n fps = 22 <--- Gets used, use a sane number (Recommended)\n snapshoturl = \"http://192.168.1.10:80/onvifsnapshot/snapshot_channel01.jpg\" <--- (Not used yet)\n readbuffer = 78643200 <--- 16 x resolution is generally recommended (Required)\n resolution = \"2560x1920\" <--- Not mandatory\n enableptz = false <--- Not used yet\n subdir = \"./videos/Garage Walkway\" <--- Recommended, manager sections basedir + name is used otherwise\n mode = \"detect_and_record_timelapse\" <--- Required\n rotation = 0 <--- Required if image is not oriented correctly\n watchdogenable = true <--- Only set to false if camera is actually just a video file \n watchdogtimer = 60 <--- Default is good\n annotation = false <--- Leave to false other than when image masking figuring out false detects, intensive overhead\n showlivevideo = false <--- Not used yet, older versions us\n facedetection = false <--- Hmm, this needs to deprecated as 'instancedetection' under objects of interest is the right\n maxreadqueue = 32 <--- Tweak per your memory availability, memory consumed is this times resolution\n detectionrate = 25 <--- Detection frequency, these many frames are skipped between detections\n detecttrackseconds = 30 <--- Automatically track this many seconds if object of interest is detected\n deletepolicyenabled = true <--- Enable automatic storage management\n deletethreshold = 60 <--- Start deleting when overall disk usage reaches this percentage\n deleteeventsthreshold = 80 <--- Start deleting videos with events when overall disk usage reaches this percentage\n deleteafterdays = 7 <--- Only delete after this many days\n log_object_timeseries = true <--- Leave at true, used for instance detection and reducing redundant notifications\n\n [camera.objects_of_interest.person] <--- Sub section for an object of interest, in this case a 'person' object\n detection_threshold = 0.98 <--- How confident the model should be that this object was detected\n instance_match_threshold = 75 <--- How confident the model should be that this is the known person based on face recognition\n instance_watch_timerange_start = 8 <--- Suppress alerts if the same object is seen within the last 8 minutes\n instance_watch_timerange_end = 2 <--- Works with above, when to start looking if the object was last seen, default is 2 mins ago\n instance_watch_continuous_mode = false <--- The object has to be continually present within the watch timerange otherwise \n alerts will be triggered \n instancedetection = false <--- Face recognition if it's a person object, (licenses for vehicles will also use this)\n notify_startup_wait = 5 <--- How long to wait after startup before notifying, otherwise it will report existing objects\n\n [camera.objects_of_interest.car]\n detection_threshold = 0.85\n instance_match_threshold = 65\n instance_watch_timerange_start = 6\n instance_watch_timerange_end = 2\n instance_watch_continuous_mode = false\n instancedetection = false\n notify_startup_wait = 5\n\n [camera.objects_of_interest.motorcycle]\n detection_threshold = 0.98\n instance_match_threshold = 75\n instance_watch_timerange_start = 8\n instance_watch_timerange_end = 2\n instance_watch_continuous_mode = false\n instancedetection = false\n notify_startup_wait = 5\n\n [camera.objects_of_interest.truck]\n detection_threshold = 0.85\n instance_match_threshold = 65\n instance_watch_timerange_start = 6\n instance_watch_timerange_end = 2\n instance_watch_continuous_mode = false\n instancedetection = false\n notify_startup_wait = 5\n\n [camera.objects_of_interest.bus]\n detection_threshold = 0.98\n instance_match_threshold = 75\n instance_watch_timerange_start = 8\n instance_watch_timerange_end = 2\n instance_watch_continuous_mode = false\n instancedetection = false\n notify_startup_wait = 5\n\n [camera.objects_of_interest.bicycle]\n detection_threshold = 0.98\n instance_match_threshold = 75\n instance_watch_timerange_start = 8\n instance_watch_timerange_end = 2\n instance_watch_continuous_mode = false\n instancedetection = false\n notify_startup_wait = 5\n\n [[\"email recepient\"]] <--- Can have any number of recipients\n name = \"First Last\" <--- Recipient Name\n email_address = \"myemail@example.com\" <--- Recipient Email\n\n [\"email sender\"]\n sender_email = \"firstlast@example.com\" <--- Email address from which the alerts are sent\n sender_login = \"firstlast@example.com\" <--- Login to use to authenticate with the smtp server\n smtp_server = \"mail.example.com\" <--- Your email providers SMTP\n smtp_server_port = 465 <--- SSL SMTP Server Port\n login_required = true <--- Only authenticated SMTP is supported \n use_SSL = true <--- Only SSL SMTP is supported \n sender_secret = \"blahblahpassword\" <--- The password\n\n [\"manager options\"]\n basedir = \"./videos/\" <--- Default storage location if not overriden on a per camera basis\n numdetectors = 1 <--- Number of detector processes, if more than 1, multiprocessing_detector \n and multiprocessing_observer has to be true\n pipelineresize = true <--- Image resizing for detection, doing it per camera (vs in detector) reduces latency \n singledetectorqueue = true <--- Use a single queue for all cameras vs one queue for all cameras, single is cheaper\n defaultmaxqueue = 32 <--- Default queue size, per camera override exists\n multiprocessing_observer = false <--- Leave these settings as is for now\n multiprocessing_detector = false\n multiprocessing_reader = false\n multiprocessing_writer = false\n multiprocessing_notifier = true\n multiprocessing_viewer = false\n multiprocessing_trainer = true\n\n**Choosing the Camera Operating Mode**\n CamAi supports four operating modes. The mode is configurable on a per camera basis. The default mode generated by the \n\n *detect_and_record_timelapse* \n Detection is on for the camera, and frames are recorded in a timelapse fashion at sample interval specified by 'detectionrate'. If any objects of interest are observed, the recording becomes continuous the number of seconds specified by 'detecttrackseconds' for that camera. If facedetection/instancedetection is enabled, the frames are further processed to scan for known instances before generating alerts. \n\n *detect_and_record_everything*\n This mode works similar to detect_and_record_timelapse, except that all frames are recorded whether or not an object of interest is detected or otherwise.\n\n *detect_only*\n This mode works similar to detect_and_record_timelapse, except that no video is recorded (other than short alert clips). Alerting etc. works exactly the same.\n\n *record_only*\n This mode turns off any detection and records every frame.\n\n\n\n**Setting up Face Recognition**\n Create a known faces directory. Follow the sample directory heirarchy.\n Put this under camai directory for now. Pictures in standard \n formats like jpg/gif/png/bmp should work. Each picture should only have \n the face of the person whose name is the parent directory.::\n\n known --->(Parent Directory)\n people --->(People Directory)\n \u2502\n \u251c\u2500\u2500 barack obama ------> (Directory is named after the person)\n \u2502\u00a0\u00a0 \u2514\u2500\u2500 barack.jpg \n \u2502\u00a0\u00a0 \u2514\u2500\u2500 vacation1.jpg \n \u2502\u00a0\u00a0 \u2514\u2500\u2500 dude3.jpg \n \u2514\u2500\u2500 Da Wife\n \u2502\u00a0\u00a0 \u2514\u2500\u2500 Wife1.png\n \u2502\u00a0\u00a0 \u2514\u2500\u2500 Spouse2.png\n \u2502\u00a0\u00a0 \u2514\u2500\u2500 IMG2019_3838383.JPEG \n \u2502\u00a0\u00a0 \u2514\u2500\u2500 BossLady.png\n \u2514\u2500\u2500 Da Hubby\n \u2502\u00a0\u00a0 \u2514\u2500\u2500 dameek1.png\n \u2502\u00a0\u00a0 \u2514\u2500\u2500 papertiger.png\n \u2514\u2500\u2500 Da Son\n \u00a0\u00a0 \u2514\u2500\u2500 slacker.jpg\n \u00a0\u00a0 \u2514\u2500\u2500 gamerboy.jpg\n \u00a0\u00a0 \u2514\u2500\u2500 prodigalreturns.jpg\n\n**Alerts**\n The following types of alerts are supported.\n\n *Verbal*\n When a new object of interest is detected, it is announced locally on the computer thats running camai. \n.. image:: docs/Alerts_Storage.png\n :width: 50\n :height: 150\n :alt: Verbal Warning \n\n\n *Email*\n When a new object of interest is detected, emails alerts are sent to the recipients specified in the configuration file. Each object of interest results in two emails, the first one with a single image and a follow up one with a short video clip. This is so that email size limits do not cause alerts to be missed.\n\n.. image:: docs/Email_Alert_with_Image.png\n :width: 50\n :height: 150\n :alt: Email Alert with Image\n\n.. image:: docs/Email_Alert_with_Video.png\n :width: 50\n :height: 150\n :alt: Email Alert with Video \n\n\n\n *Stored*\n Every alerts image and video clipping is stored by default in the 'basedir' specified in the manager section. These alert files are not automatically pruned or managed unlike the video recordings.\n\n.. image:: docs/Alerts_Storage.png\n :width: 50\n :height: 150\n :alt: Storage Alert Image \n\n\n\n\n", "description_content_type": "text/markdown", "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/castleguarders/CamAi", "keywords": "", "license": "", "maintainer": "", "maintainer_email": "", "name": "CamAi-castleguarders", "package_url": "https://pypi.org/project/CamAi-castleguarders/", "platform": "", "project_url": "https://pypi.org/project/CamAi-castleguarders/", "project_urls": { "Homepage": "https://github.com/castleguarders/CamAi" }, "release_url": "https://pypi.org/project/CamAi-castleguarders/0.0.1/", "requires_dist": null, "requires_python": ">=3.6", "summary": "AI based Camera monitor and alerting system", "version": "0.0.1" }, "last_serial": 5918777, "releases": { "0.0.1": [ { "comment_text": "", "digests": { "md5": "8af2196bcb3ed618f7a5bfdbff2c9d25", "sha256": "5b97e26b7e4af13b78497ae322a1c142eca2518bf0e760ec21ca53362979b353" }, "downloads": -1, "filename": "CamAi_castleguarders-0.0.1-py3-none-any.whl", "has_sig": false, "md5_digest": "8af2196bcb3ed618f7a5bfdbff2c9d25", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": ">=3.6", "size": 120571, "upload_time": "2019-10-02T16:16:12", "url": "https://files.pythonhosted.org/packages/ac/f6/1b51a97a39a4a8dfb42164a1741020b074693b5389ece0ad2a623e40bb33/CamAi_castleguarders-0.0.1-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "f6e21f663a01bb95d96c0608d3fc3d54", "sha256": "6cf0a252ae54b4481ab6199eff0ff484978be9de64eb2f81d107701d201857ab" }, "downloads": -1, "filename": "CamAi-castleguarders-0.0.1.tar.gz", "has_sig": false, "md5_digest": "f6e21f663a01bb95d96c0608d3fc3d54", "packagetype": "sdist", "python_version": "source", "requires_python": ">=3.6", "size": 107479, "upload_time": "2019-10-02T16:16:15", "url": "https://files.pythonhosted.org/packages/91/9f/30d551884550ea751acef7cc9909cce56ed5c13c6930f9e0ea711ac1c0ae/CamAi-castleguarders-0.0.1.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "8af2196bcb3ed618f7a5bfdbff2c9d25", "sha256": "5b97e26b7e4af13b78497ae322a1c142eca2518bf0e760ec21ca53362979b353" }, "downloads": -1, "filename": "CamAi_castleguarders-0.0.1-py3-none-any.whl", "has_sig": false, "md5_digest": "8af2196bcb3ed618f7a5bfdbff2c9d25", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": ">=3.6", "size": 120571, "upload_time": "2019-10-02T16:16:12", "url": "https://files.pythonhosted.org/packages/ac/f6/1b51a97a39a4a8dfb42164a1741020b074693b5389ece0ad2a623e40bb33/CamAi_castleguarders-0.0.1-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "f6e21f663a01bb95d96c0608d3fc3d54", "sha256": "6cf0a252ae54b4481ab6199eff0ff484978be9de64eb2f81d107701d201857ab" }, "downloads": -1, "filename": "CamAi-castleguarders-0.0.1.tar.gz", "has_sig": false, "md5_digest": "f6e21f663a01bb95d96c0608d3fc3d54", "packagetype": "sdist", "python_version": "source", "requires_python": ">=3.6", "size": 107479, "upload_time": "2019-10-02T16:16:15", "url": "https://files.pythonhosted.org/packages/91/9f/30d551884550ea751acef7cc9909cce56ed5c13c6930f9e0ea711ac1c0ae/CamAi-castleguarders-0.0.1.tar.gz" } ] }