snowzach / doods2

API for detecting objects in images and video streams using Tensorflow
MIT License
232 stars 30 forks source link

config.yaml not used? #55

Closed DutchessNicole closed 1 year ago

DutchessNicole commented 2 years ago

I'm running doods2 on a system that cannot use docker. So I have the files downloaded and I run it using a service file as a system service. This seems to work okay, except for the fact that I cannot seem to make the config file work.

All I really wanted to do was change to font size for the detections and the colour of the capture area box to be a little less gaudy, but so far I can't seem to get any changes to stick.

I've put the sources in /home/nicole/doods2/src/doods2 with the required libraries for it in /home/nicole/doods2/bin|include|lib|share. All python libraries live there and this works overall.

The service file that makes this works is as follows:

[Unit]
Description=DOODS2 image detection service
After=multi-user.target

[Service]
Type=simple
User=nicole
WorkingDirectory=/home/nicole/doods2/src/doods2/
ExecStart=/home/nicole/doods2/bin/python3 main.py --config=/home/nicole/doods2/src/doods2/config.yaml
Environment="PATH=/home/nicole/doods2/bin:$PATH"
Restart=always

StandardOutput=file:/var/log/doods2.log
StandardError=file:/var/log/doods2.err.log

[Install]
WantedBy=multi-user.target

Note that I added the --config flag to ExecStart, but this is the part that doesn't seem to work. No error is thrown, but no config changes are being implemented, either.

There is a mention of the config.yaml file in the readme but it specifically talks about docker, and not just as a standalone service. Is there anything I need to do in particular to get the config file to be picked up, other than the inclusion of the --config= flag?

Also, is the example structure given in the readme correct? Perhaps it doesn't use my changes because the example doesn't make sense and it reverts to the built-in defaults instead.

snowzach commented 2 years ago

I'm not sure... Maybe it's something the way you are running it... If it can't find the file it will error out:

# python3 main.py --config missing.yaml
Traceback (most recent call last):
  File "main.py", line 75, in <module>
    main()
  File "main.py", line 43, in main
    with open(config_file, 'r') as stream:
FileNotFoundError: [Errno 2] No such file or directory: 'missing.yaml'

I'm not the best at writing systemd configs. It looks right.. maybe you can put it in a script and run that. The config file is correct. If you want to copy the default config.yaml from here and modify it you can: https://github.com/snowzach/doods2/blob/master/config.yaml

DutchessNicole commented 1 year ago

The config is indeed copied from there but that's the thing, it's not picked up at all, but no error is thrown either. It really just looks like the --config flag is being ignored. As an aside, I was trying to get anything but the pytorch detector to work and that also doesn't seem to work. Are there any instructions on where to put the trained models in the directory structure?

The readme is very unclear on how to do such a thing.

snowzach commented 1 year ago

The --config flag defaults to looking for a config.yaml so if there is a file there, it's using that. If you specify an option it should try to read that and error out (as shown above) If it's not, I suspect your command arguments aren't being passed..

The stuff you have to do to compile tensorflow to get it to work is just awful... .awful awful... absolute torture.. I spent more time on that than I did writing doods probably. The fact that anything works at all I am a little surprised honestly. I really recommend something you can run docker on as the dependencies are a huge pain to get right.