geezacoleman / OpenWeedLocator

An open-source, low-cost, image-based weed detection device for in-crop and fallow scenarios.
MIT License
352 stars 64 forks source link

Bug: `input_file_or_directory` Field in [System] Config Not Taking Effect #158

Closed bwx0 closed 1 day ago

bwx0 commented 1 week ago

Description

It seems that OWL is not reading from the video file specified in the input_file_or_directory field under the [System] section of the configuration file.

It looks like this behavior might be due to a missing else statement on line 293 of owl.py.

Steps to Reproduce

  1. Set the input_file_or_directory field e.g. ../videos/example.mp4
  2. Run the OWL script. python owl.py --show-display
  3. Observe that the video file is not being processed as expected. Instead, it is reading from the camera.

Suggested Fix

Add an else: statement on line 293 in owl.py as mentioned above.

geezacoleman commented 1 week ago

Good find! Thanks for working this out - there are a couple of other changes I'm making to make the code more readable/robust/better at catching errors when setting everything up so I should have it updated by early next week.

You can follow the progress on the branch assigned below.

geezacoleman commented 1 day ago

This should be fixed now - have restructured the media setup generally and made it more robust with clearer errors.

Let me know if you have any further suggestions.

bwx0 commented 5 hours ago

Thanks for addressing the issue! I'll sync my local repo. Actually I'm quite impressed by the detailed error report system!

geezacoleman commented 4 hours ago

Thanks! Inexplicable errors 'bug' me, so I have tried (through LLMs at least) to make these as clear with reasonable solutions as possible. Won't catch everything, but for the common ones I think it will help people out. Went so far as to cut a camera cable to see what error would result - turns out it's just an IndexError.

If you come across an error that would benefit from a decent explanation/solution then raise it as an issue/make a pull request and we can add it to the list!