Giter VIP home page Giter VIP logo

Comments (18)

backslashV avatar backslashV commented on August 16, 2024 1

Absolutely. Will do it in some time. 👌

from swatch.

NickM-27 avatar NickM-27 commented on August 16, 2024 1

Okay, then yeah please create a new issue in the integration. Most likely it is not able to connect to the addon correctly, will have to see how I can fix that.

Connecting to the addon is more complicated than directly to a docker container hosted in docker

from swatch.

NickM-27 avatar NickM-27 commented on August 16, 2024

Hi, thanks for this comprehensive issue. There are a few things here:

  1. Detect isn't meant to be run on the entire image and just the cropped image, it sounds like the results are from that which is interesting.
  2. There is definitely some tuning to be done for some of these cases, but the night_stoplight case where the area is 846 seems to be a success unless that is for the entire image. Your min_area of 1000 is just too high for that small of an object.

My methodology so far is to use the rgb viewer to see what the dominant color is, set the lower r,g,b to the dominant r * .9,g * .9,b * .9 and the upper r,g,b to r * 1.1,g * 1.1, b * 1.1 and try that.

Thanks for the patience, as I said I intend to get a UI soonish that will make this easier

from swatch.

NickM-27 avatar NickM-27 commented on August 16, 2024

Also, the latest version will be changing the config so that it supports multiple color-variants so there aren't multiple objects created for the same "object" in different lighting conditions

from swatch.

backslashV avatar backslashV commented on August 16, 2024

Thank you for your response. Regarding #1, should I provide the cropped image to the detect API endpoint? I thought Swatch does the cropping itself. Otherwise, what's the point of providing the coordinates in the config?

from swatch.

NickM-27 avatar NickM-27 commented on August 16, 2024

I thought Swatch does the cropping itself. Otherwise, what's the point of providing the coordinates in the config?

Yes, that is correct, I think I just misunderstood what you meant above.

from swatch.

backslashV avatar backslashV commented on August 16, 2024

Thanks.

from swatch.

NickM-27 avatar NickM-27 commented on August 16, 2024

@backslashV You will want to check out latest 2.0 version which includes ui to adjust color values in real time to see what the mask will look like.

from swatch.

backslashV avatar backslashV commented on August 16, 2024

Would you be able to update the HA addon with the new config options and the UI editor?

from swatch.

NickM-27 avatar NickM-27 commented on August 16, 2024

Would you be able to update the HA addon with the new config options and the UI editor?

Did it not already get the new version? I'll do that

from swatch.

backslashV avatar backslashV commented on August 16, 2024

It seems the new config isn't supported on HA still:

Importing SwatchApp Config
Verified SwatchApp Config
Traceback (most recent call last):
  File "/usr/local/lib/python3.10/runpy.py", line 196, in _run_module_as_main
    return _run_code(code, main_globals, None,
  File "/usr/local/lib/python3.10/runpy.py", line 86, in _run_code
    exec(code, run_globals)
  File "/opt/swatch/swatch/__main__.py", line 14, in <module>
    swatch_app = SwatchApp()
  File "/opt/swatch/swatch/app.py", line 21, in __init__
    self.__init_config__()
  File "/opt/swatch/swatch/app.py", line 35, in __init_config__
    user_config = SwatchConfig.parse_file(config_file)
  File "/opt/swatch/swatch/config.py", line 126, in parse_file
    return cls.parse_obj(config)
  File "/usr/local/lib/python3.10/site-packages/pydantic/main.py", line 511, in parse_obj
    return cls(**obj)
  File "/usr/local/lib/python3.10/site-packages/pydantic/main.py", line 331, in __init__
    raise validation_error
pydantic.error_wrappers.ValidationError: 2 validation errors for SwatchConfig
cameras -> garage_cam -> snapshot_config -> mode
  extra fields not permitted (type=value_error.extra)
cameras -> garage_cam -> snapshot_config -> snapshot_url
  extra fields not permitted (type=value_error.extra)

Also, I am getting 400 Bad Request when trying to run detect via REST API:

<!doctype html><html lang=en><title>400 Bad Request</title><h1>Bad Request</h1><p>The browser (or proxy) sent a request that this server could not understand.</p>

Maybe that's why HA service calls also are not detecting anything and /color_playground isn't showing any image after passing in the image URL.

from swatch.

NickM-27 avatar NickM-27 commented on August 16, 2024

Have you been running in HA OS the whole time? I think there may be more required to get it to work.

As far as the config goes can you paste the whole thing?

from swatch.

backslashV avatar backslashV commented on August 16, 2024

Yes, I'm using HA OS. Here's the config

objects:
  stop_sign:
    color_variants:
      midday:
        color_lower: 158, 140, 140
        color_upper: 194, 170, 172
      evening:
        color_lower: 162, 146, 153
        color_upper: 198, 178, 187
      night_lights_on:
        color_lower: 62, 40, 43
        color_upper: 76, 50, 53
      night_spotlight:
        color_lower: 89, 67, 80
        color_upper: 109, 81, 98
    min_area: 55000
    max_area: 190000

cameras:
  garage_cam:
    # auto_detect: 300
    # snapshot_config:
    #   snapshot_url: "<image url here>"
    #   save_detections: false
    #   save_misses: false
    #   mode: "all"
    #   retain_days: 7
    zones:
      door:
        coordinates: 641, 727, 1360, 1440
        objects:
          - stop_sign

from swatch.

NickM-27 avatar NickM-27 commented on August 16, 2024

The snapshot_url should just be url under snapshot_config

I think I have a couple errors in the docs I'll need to fix

from swatch.

backslashV avatar backslashV commented on August 16, 2024

Thanks. Also "mode" should be "snapshot_mode", but I think "mode" is better since this is already nested under snapshot_config. There seems to be other errors with this update on HA:

Unexpected error fetching swatch data:
Traceback (most recent call last):
  File "/config/custom_components/swatch/api.py", line 98, in api_wrapper
    response = await self._session.get(
  File "/usr/local/lib/python3.9/site-packages/aiohttp/client.py", line 559, in _request
    await resp.start(conn)
  File "/usr/local/lib/python3.9/site-packages/aiohttp/client_reqrep.py", line 898, in start
    message, payload = await protocol.read()  # type: ignore[union-attr]
  File "/usr/local/lib/python3.9/site-packages/aiohttp/streams.py", line 616, in read
    await self._waiter
asyncio.exceptions.CancelledError

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/config/custom_components/swatch/api.py", line 115, in api_wrapper
    return await response.json()
  File "/usr/local/lib/python3.9/site-packages/async_timeout/__init__.py", line 129, in __aexit__
    self._do_exit(exc_type)
  File "/usr/local/lib/python3.9/site-packages/async_timeout/__init__.py", line 212, in _do_exit
    raise asyncio.TimeoutError
asyncio.exceptions.TimeoutError

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 191, in _async_refresh
    self.data = await self._async_update_data()
  File "/config/custom_components/swatch/__init__.py", line 170, in _async_update_data
    raise exc
  File "/config/custom_components/swatch/__init__.py", line 168, in _async_update_data
    return await self._api.async_get_object_state("all")
  File "/config/custom_components/swatch/api.py", line 76, in async_get_object_state
    await self.api_wrapper(
  File "/config/custom_components/swatch/api.py", line 123, in api_wrapper
    raise SwatchApiClientError from exc
custom_components.swatch.api.SwatchApiClientError

Please let me know if I need to open another issue.

from swatch.

NickM-27 avatar NickM-27 commented on August 16, 2024

Are these errors happening while the addon is running? These would make sense if the addon isn't working since it would timeout because it can't reach it

from swatch.

NickM-27 avatar NickM-27 commented on August 16, 2024

Will update the config names shortly

from swatch.

backslashV avatar backslashV commented on August 16, 2024

Are these errors happening while the addon is running? These would make sense if the addon isn't working since it would timeout because it can't reach it

Yes, at least the new UI loads and the addon log shows

Starting SwatchApp
Importing SwatchApp Config
Verified SwatchApp Config
Starting Auto Detection for garage_cam
Starting snapshot cleanup for garage_cam

from swatch.

Related Issues (20)

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.