Git Product home page Git Product logo

deepstack-trainer's Introduction

Hi, I'm Tomer Klein

👋 I'm a passionate C#/Python developer with a knack for IoT innovations and a fervent love for open source projects. I thrive on turning smart home dreams into reality, weaving technology into everyday life. 🌟 My journey involves not just writing code but creating experiences. I believe in the transformative power of technology to improve our lives and I'm on a mission to make it happen.

  • 🐳 I'm currently working on developing Docker containers 😁
  • 🏠 I love to contribute to Home automation projects 😁
  • 🤖 I love electronics and DIY projects 😁
  • 🥅 2024 Goals: Enter to the AWS Heros list
  • 💬 Ask me about anything, I am happy to help 😄
  • 🧗 I try to: Go beyond and push the bounds
  • ⚡ Fun fact: I love connecting with different people 🙌

Tomer Klein profile views

Connect with me

Gmail Facebook LinkedIn Discord Twitter

Tech Knowledge

Languages

C# Python JavaScript PHP Bash Html5 CSS3

Libraries and Frameworks

.NET FastAPI Flask Bootstrap jQuery Selenium

Infrastructure and DevOps

Git GitHub Docker RabbitMQ Mosquitto MySQL MSSQL SQLite AWS AzureDevOps Apache Nginx Traefik Cloudflare

Enviroment, IDEs and Tools

Visual Studio Community/Enterprise Visual Studio Code Postman Windows Ubuntu Centos Debian

Firewall, WAF and Security tools

Checkpoint Sophos Fortigate F5BigIP SolarWinds Siem Mcafee DLP

IoT

Raspberry PI Arduino LoRa MQTT ESP Chirpstack

Let's see how I did this year:

Github stats Top Langs

trophy

Open source projects

🎁 Projects ⭐ Stars 📚 Forks 🛎 Issues 📬 Pull requests 🐳 Container Pulls
Broadlink Manager docker Stars Forks Issues Pull Requests
Safe URL Stars Forks Issues Pull Requests
Apprise API Bridge Stars Forks Issues Pull Requests
Deepstack Trainer Stars Forks Issues Pull Requests
DeCompose Stars Forks Issues Pull Requests
Wazy Stars Forks Issues Pull Requests
voicy Stars Forks Issues Pull Requests
certi Stars Forks Issues Pull Requests
Xiaomi Token Extractor Stars Forks Issues Pull Requests
Arpspoof Docker Stars Forks Issues Pull Requests
HAvid-19 Stars Forks Issues Pull Requests
Botvid-19 Stars Forks Issues Pull Requests
Botigen Stars Forks Issues Pull Requests
Dockerbot Stars Forks Issues Pull Requests
Redalert Stars Forks Issues Pull Requests
ttsbot Stars Forks Issues Pull Requests
OCR docker Stars Forks Issues Pull Requests
Gotenberg ui Stars Forks Issues Pull Requests
TTS-STT Stars Forks Issues Pull Requests

deepstack-trainer's People

Contributors

t0mer 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

Watchers

 avatar  avatar

deepstack-trainer's Issues

Custom Model DeepStack_ActionNET

Deepstack has an interesting feature, it's deepstack_actionet. How to add this custom model actionnetv2.pt in deepstack server, I described here. Is it possible to add support for custom models to your client so that it works through the integration of HASS Deepstack object? For example, upload a photo of an object's action and give a name, as in the case of a photo and as the object's action will be recognized, then the Home Assistant will have the name of the action of this object.

The Trained Model can detect the following actions in images and videos.

calling
clapping
cycling
dancing
drinking
eating
fighting
hugging
kissing
laughing
listening-to-music
running
sitting
sleeping
texting
using-laptop

Photo Gallery \ Фото галерея

Thank you for the great component for deepstack. Can you add a photo gallery? It would be very convenient to know which photos were uploaded.
Спасибо вам за отличный компонент для deepstack. Можете добавить фото галерею? Это было бы очень удобно, чтобы знать какие фотографии были загружены.

Network Adapter issue

Hello @t0mer, I have encountered such issue. I followed the steps that you have mentioned earlier. Did I miss out something?

Aw Snap! something went wrong - No connection adapters were found for 192.x.y.z/v1/vision/face/register

Creating the DeepStack Trainer addon

Thank you for your wonderful DeepStack Trainer client. DeepStack Trainer is an excellent and convenient program. Home Assistant is the most popular smart home platform today and I would like Home Assistant to have a DeepStack Trainer addon.

I have never done addons and decided to make a DeepStack Trainer addon for Home Assistant. I managed to create it, but not everything works as well as I wanted. The DeepStack Trainer addon works until you restart the addon. The problem is that the images database.db and photos in the /opt/trainer/photos/uploads folder are not saved and after restarting the DeepStack Trainer addon, they are erased. If you install DeepStack Trainer via Portainer, then the images and the database are not erased and you can still connect folders. But the problem is that the addon for Home Assistant is more convenient to use, installed, prescribed paths and you can use it.

That's how I specify folder paths in the Portainer
2022-09-04_02-48-21

I'm not that good at python, but I understand and use literature a bit. So that's what I did

This paragraph is responsible for copying files, and here I have embedded these lines so that files are copied to the Home Assistant during training

shutil.copy2(src_file_images_db, dest_file_db) #copy the database from docker to homeassistant
shutil.copytree(src_file_photos, dest_file_photos, dirs_exist_ok=True) #copy the photos from docker to homeassistant

This is the code from the file trainer.py

# from aiofiles import open
db_path='./db/images.db'
deepstack_host_address = os.getenv("DEEPSTACK_HOST_ADDRESS")
deepstack_api_key = os.getenv("DEEPSTACK_API_KEY")
min_confidence = os.getenv("MIN_CONFIDANCE")

#copy the database from docker to homeassistant
src_file_images_db='/opt/trainer/db/images.db'
src_file_db='/opt/trainer/db'
dest_file_db = os.getenv("HOMEASSISTANT_FOLDER_PATH_FOR_DATABASE")

#copy the photos from docker to homeassistant
src_file_photos= '/opt/trainer/photos/uploads'
dest_file_photos = os.getenv("HOMEASSISTANT_FOLDER_PATH_FOR_PHOTOS")

#copy the database from homeassistant to docker 
src_file_db_bkp = os.getenv("HOMEASSISTANT_FOLDER_PATH_FOR_DATABASE")
dest_file_db_bkp='/opt/trainer/db'

#copy the photos from homeassistant to docker 
src_file_photos_bkp = os.getenv("HOMEASSISTANT_FOLDER_PATH_FOR_PHOTOS")
dest_file_photos_bkp='/opt/trainer/photos/uploads'

def SaveImage(file, path):
    logger.info("Saving the image to the file system")
    try:
        with open(path, "wb") as buffer:
            shutil.copyfileobj(file, buffer)
            shutil.copy2(src_file_images_db, dest_file_db) #copy the database from docker to homeassistant
            shutil.copytree(src_file_photos, dest_file_photos, dirs_exist_ok=True) #copy the photos from docker to homeassistant
        logger.info("File saved")
    except Exception as e:
        logger.error("Unable to save file " + str(e))
        raise Exception(str(e))

You need to copy files to these folders and then restore them from them after launching the DeepStack Trainer addon

  "HOMEASSISTANT_FOLDER_PATH_FOR_DATABASE": "/config/deepstack/db",
  "HOMEASSISTANT_FOLDER_PATH_FOR_PHOTOS": "/config/deepstack/photos"

Trying to follow the documentation on building an addon for Home Assistant I found that on Ubuntu 20.04 it is not possible to copy run.sh , and in Debian it is possible. Your techblog/fastapi:latest build is built on Ubuntu 20.04. I rebuilt the image for docker, where Debian 11 slim-stable was chosen as the OS. My build divanx10/debian 11-facet api on Debian 11 slim-stable. The script is needed in order to overwrite the parameters in ENV. In ardon, in the configuration section, you can specify the paths to save and this data is written to the options file.json, and the set parameters are read from this file and written to ENV. But since ENTRYPOINT ["/usr/bin/python 3", "trainer.py "] is specified to run DeepStack Trainer, then I can't run the script run.sh . DeepStack Trainer just won't start.

I have two versions of the repository for addons, where one version is combat and I don't debug there, and in the test version I am working on the DeepStack Trainer addon. I would like to ask you to help me build the DeepStack Trainer addon or, if there is a desire, build it yourself. Thanks.

How to build an addon
https://developers.home-assistant.io/docs/add-ons/tutorial

Combat version https://github.com/DivanX10/Home-Assistant-Add-on-Deepstack
Test version https://github.com/DivanX10/Home-Assistant-Add-on-DeepStack-Edge

Allow Deepstack on other port?

In your documentation/example you show that port 80 needs to be accessible and forwarded to port 5000 of the Deepstack instance. I have port 80 tied to a different container, unfortunately, can I specify port 5000 for the deepstack instance somehow?

Photo gallery editing

Thank you for adding the gallery, it became just super. Tell me, is there a possibility, and is it even possible to add a photo deletion function to the gallery and edit the name of the photo?

"standard_init_linux.go:219: exec user process caused: exec format error' installing on Jetson

jason@jetson01:/deepstack_trainer$ sudo docker-compose up
Creating network "deepstack_trainer_default" with the default driver
Creating deepstack_trainer ... done
Attaching to deepstack_trainer
deepstack_trainer | standard_init_linux.go:219: exec user process caused: exec format error
jason@jetson01:
/deepstack_trainer$ sudo docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
ebf072f934a1 techblog/deepstack-trainer "/usr/bin/python3 /o…" 12 seconds ago Restarting (1) 1 second ago deepstack_trainer
6dfbffdb7611 deepquestai/deepstack:jetpack "/app/server/server" 13 minutes ago Up 13 minutes 0.0.0.0:80->5000/tcp pedantic_wiles

Custom model training fails, need to downgrade torch (and setuptools)

Hi,

I am using the deepquestai/deepstack:gpu-2022.01.1 container to do custom training. It comes with torch for cuda 11.3 but train.py fails after initiation (see error below). This is resolved when I downgrade to torch for cuda 11.0 (pip install torch==1.7.0+cu110 torchvision==0.8.1+cu110 torchaudio===0.7.0 -f https://download.pytorch.org/whl/torch_stable.html as per the collab notebook).

docker run --gpus all -it --rm -v /home/eouser/deepstack:/deepstack/code -w /deepstack/code/deepstack-trainer deepquestai/deepstack_updated:gpu python3 train.py --dataset-path /deepstack/code/data
Traceback (most recent call last):
File "train.py", line 530, in
train(hyp, opt, device, tb_writer, wandb)
File "train.py", line 90, in train
model = Model(opt.cfg or ckpt['model'].yaml, ch=3, nc=nc).to(device) # create
File "/deepstack/code/deepstack-trainer/models/yolo.py", line 96, in init
self._initialize_biases() # only run once
File "/deepstack/code/deepstack-trainer/models/yolo.py", line 151, in _initialize_biases
b[:, 4] += math.log(8 / (640 / s) ** 2) # obj (8 objects per 640 image)
RuntimeError: a view of a leaf Variable that requires grad is being used in an in-place operation.

I first need to downgrade setuptools inside the container, btw, because otherwise it throws:

Traceback (most recent call last):
File "train.py", line 21, in
from torch.utils.tensorboard import SummaryWriter
File "/usr/local/lib/python3.7/dist-packages/torch/utils/tensorboard/init.py", line 4, in
LooseVersion = distutils.version.LooseVersion
AttributeError: module 'setuptools._distutils' has no attribute 'version'

(resolved with: pip install setuptools==59.5.0)

I am now happily training with the revised setup, so nothing too urgent, but maybe worth checking out.

Thx for this wonderful framework!

Guido

deepstack-trainer not working

I am setting up a deepstack-trainer using docker-compose but it doesn't seem to work.. not sure what's wrong.

Note that I am using docker on win 10 machine.

Here is my docker-compose

version: "3.9"
services:
  deepstack:
    container_name: deepstack
    restart: unless-stopped
    image: deepquestai/deepstack
    ports:
      - '80:5000'
    environment:
      - VISION-FACE=True
      - VISION-DETECTION=True
      - VISION-SCENE=True
      - API-KEY="deepstack"
    volumes:
      - ./localstorage:/datastore
    networks:
      - deepstacknet
  deepstack_ui:
    container_name: deepstack_ui
    restart: unless-stopped
    image: robmarkcole/deepstack-ui:latest
    environment: 
      - DEEPSTACK_IP=192.168.29.100
      - DEEPSTACK_PORT=80
      - DEEPSTACK_API_KEY="deepstack"
      - DEEPSTACK_TIMEOUT=20
      - DEEPSTACK_UI_DEBUG_MODE=True
    ports:
      - '8501:8501'
    networks:
      - deepstacknet
  deepstack_trainer:
    image: techblog/deepstack-trainer
    container_name: deepstack_trainer
    privileged: true
    restart: always
    environment:
      - DEEPSTACK_HOST_ADDRESS=http://192.168.29.100:80
      - DEEPSTACK_API_KEY="deepstack"
      - MIN_CONFIDANCE=60
    ports:
      - "8080:8080" 
    volumes:
      - ./deepstack-trainer/db:/opt/trainer/db #Database storing the uploaded photos data (Filename, Person name, Date).
      - ./deepstack-trainer/uploads:/opt/trainer/photos/uploads #Phisical path for storing the images
networks:
  deepstacknet:
    driver: bridge

Here is the error I am getting..
image

image

image

Pls guide, what could be wrong?

Face Learning Teach Me button does nothing

Running in docker on Unraid, just pulled the from docker hub with deepstack version "DeepStack: Version 2021.02.1"
following enabled
/v1/vision/face

/v1/vision/face/recognize

/v1/vision/face/register

/v1/vision/face/match

/v1/vision/face/list

/v1/vision/face/delete

/v1/vision/detection

/v1/vision/scene

I browse to an image
Type in a name
and click Teach me and get no response. No error, but no response.
If I leave off the name I get an error stating I need a name

If I use Face Recognition
browse to an image
Click who is it
I get (Success) the person in the picture is No connection adapters were found for IP address:5000/v1/vision/facerecognize

I also get errors when using Object Detection and Scene Detection:
Error
No connection adapters were found for IP address:5000/v1/vision/detection Although I do use BlueIris and it does detect objects.
Same error with Scene, but with /v1/vision/scene

ModuleNotFoundError: No module named 'flask_restful'

Hello, wonderful work! I also want to be part of it. The container does not start and the log file says:

Traceback (most recent call last): File "/opt/trainer/trainer.py", line 3, in <module> from flask_restful import Resource, Api ModuleNotFoundError: No module named 'flask_restful'

I have set all necessary parameter like DEEPSTACK_HOST_ADDRESS etc. Do I have to install flask_restful manually or do I have to do something else?

Instructions: setting up Deepstack and DeepStack Trainer in Docker on Synology \ Инструкция: настройка Deepstack и DeepStack Trainer в Docker на Synology

Setting up deepstack in the screenshots. This can make it easier for those who don't understand how to configure deepstack in Docker on Synology.

Настройка deepstack на скриншотах. Это может облегчить тем, кто не понимает как можно настроить deepstack в Docker на Synology.

Setting up deepquestai/deepstack

Настройка deepquestai/deepstack

deepstack_setup_01
deepstack_setup_02
deepstack_setup_03
deepstack_setup_04
deepstack_setup_05
deepstack_setup_06

Configuring the Deepstack Trainer

Настройка Deepstack Trainer

image
deepstack-web-ui_setup_02
deepstack-web-ui_setup_03
deepstack-web-ui_setup_04
deepstack-web-ui_setup_05

image

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.