Giter Club home page Giter Club logo

action's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

action's Issues

Exits without an error message if the file does not exist

Running the action.py command with a file name that doesn't exist causes the program to exit, but does not provide an error message/explanation to the user of what went wrong. It looks like the program just doesn't do anything.

Consider breaking action.py into smaller files

I wanted to start a discussion about whether or not to break the actions.py file into smaller files or leave it as one.

If I was doing this on my own, I'd break it up. However, I don't want to impose my style of working on you if it would be easier to have everything in one file.

If I did this, I'd probably end up with files like:

action.py         <-- our main file that you'd run
ui.py             <-- functions related to drawing the rectangles and other "user interface" stuff
model.py          <-- functions related to working with YOLO-fish, doing detections, etc
utils.py          <-- miscellaneous functions that don't belong anywhere else

The action.py file would import functions from these other files, so it would become quite short. However, to find things, you'd have to jump around between files, which you might find confusing.

Let me know what you think. I can go either way, but want this code to be something you can navigate and change.

A good example of what a Python project like this would look like is the Birdnet-Analyzer that I'm using to detect birds with my AudioMoth. You can see that it has files like:

analyze.py
audio.py
model.py
species.py
...

You use analyze.py (like our action.py) and it uses all the other files.

You might also find their README file interesting to see, as a model for how we could write ours. I think we should put a cool image of fish being detected with bounding boxes in it.

Consider adding a pause/play feature

Would we be able to add a feature to pause while action is running through a large file, and then play to resume from that same point? We wouldn't want more than one paused session at once. If resuming a paused session, it would need to ignore the -d.

Crash when processing multiple files

I noticed when I ran the command python action.py ./video/*.mov -c 0.45 -m 4.0 -s -b 1.0 -d this error message appeared:

Starting file 1 of 3: ./video/20230817_095737_trimmed.mov - 22:23 - 40290 frames at 30.0 fps, skipping every 15 frames
Using confidence threshold 0.45, minimum clip duration of 4.0 seconds, and 1.0 seconds of buffer.
Fish detected, starting detection event: 00:12 (max confidence=88.85%)
Detection period ended: 00:18 (duration=00:06, max confidence=88.85%)
Process Process-1:
Traceback (most recent call last):
  File "/Users/MorganHumphrey/action/action.py", line 59, in create_clip_process
    clip_filename = f"{get_clips_dir(video_path)}/{(clip_count):03}-{format_time(clip_start_time, '_')}-{format_time(clip_end_time, '_')}{os.path.splitext(video_path)[1]}"
                       ^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/MorganHumphrey/action/action.py", line 20, in get_clips_dir
    return f"{os.path.splitext(video_path)[0]}_clips"
              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "<frozen posixpath>", line 118, in splitext
TypeError: expected str, bytes or os.PathLike object, not list

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/opt/homebrew/Cellar/[email protected]/3.11.4_1/Frameworks/Python.framework/Versions/3.11/lib/python3.11/multiprocessing/process.py", line 314, in _bootstrap
    self.run()
  File "/opt/homebrew/Cellar/[email protected]/3.11.4_1/Frameworks/Python.framework/Versions/3.11/lib/python3.11/multiprocessing/process.py", line 108, in run
    self._target(*self._args, **self._kwargs)
  File "/Users/MorganHumphrey/action/action.py", line 79, in create_clip_process
    except queue.Empty:
           ^^^^^^^^^^^
AttributeError: 'Queue' object has no attribute 'Empty'
Fish detected, starting detection event: 00:30 (max confidence=69.03%)
Detection period ended: 00:36 (duration=00:06, max confidence=69.03%)

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.