Skip to content

Merge Gui into main #180

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 18 commits into
base: main
Choose a base branch
from
Open

Merge Gui into main #180

wants to merge 18 commits into from

Conversation

davidpagnon
Copy link
Collaborator

Merge Gui branch (@AYLARDJ) into main

AYLARDJ and others added 12 commits December 6, 2024 12:43
* compute height

* revert

* height for LSTm

* debug_1

* moved backend and device selection out of main function

* Handle case where Hip marker is missing (Coco, body_25b, mediapipe)

* fix_1

* fixed error, but not multi-person(pytest)

* remove test

* Fix error caused by stationary person in multi-person detection by decreasing close_to_zero_speed_m.

* parameters from markerAugmentation

* Modify Hip calculation

* Fix length mismatch

* Move functions and other few changes

* 'auto' for scaling

* Increased pro-sup rom

* cut_off_frequency as an argument

* improved the gait events clean-up to make sure the occasional spikes are ignored, and that it still works for gait when there is no flight phase

* round fps to an integer as it sometimes leads to errors in VideoWriter

* more informative message error in best_coords_for_measurementswhen not moving or badly detected

* Removed Lai-Uhlrich shoulder definition in LSTM model, released wrist flexion range, corrected Config typo

* forgot this one

* removed LSTM shoulder coordinate tasks

* main person -> person with lowest reprojection error

* - Default names for Halpe_26, coco_133, coco_17: body_with_feet, whole_body, body
- Optional manual selection of backend and device

* test CI fix

* fixed latest issue: fallback to original data if Q_coords_low_speeds_low_angles is empty, and sync does not work in multiperson if all keypoints are used (on our Demo data)

* disable display_detection on Config Batch

* More info on pose estimation

* solved edge cases for automatic height calculation, and Reorganizing files for Sports2D consistency

* custom logging if needed

* custom logging if needed

* fixed issue when subject_height not 'auto'

* solve issue with custom_logging

* changed get_selected_id_list function name to select_person

* stupid mistake

* fixed other stupid mistake, sorry

* Any person detection and/or pose estimation model can now be used + many other changes

* custom rtmlib version until pull request is accepted

* Kinematics now works with Coco17 model (not marker augmentation)

* Updated readme with custom pose estimation

* Rename some functions + minor edits in Readme

* edit readme

* Support drawing skeleton of custom model

* Support drawing skeleton of custom model

* custom output path when called within Python

* proceeds video files in alphabatical order

* sports2D skeleton by default (color of bounding box different per person, keypoint color function of confidence)

* fixed last push

* Implemented DeepSort tracking + Sped up calibration (LU rather than SVD decomposition, thanks @ANaaim)

* fixed previous commit

* Fixed previous commit

* Fixed previous commit

* Another stupid mistake

* a

* deepsort requires torch. Rather than making it a default dependency, tested by installing it in CI script

* Update continuous-integration.yml

* embedder None to avoid torch torchvision dependency

* OpenSim cannot be installed on MacOS-latest with Python<3.10 anymore

* Installs conda and OpenSim for IK

* remove "Mouth21" (#159)

* Kinematics with contact spheres and muscles by default + separated markersets to model files

* replaced image with contact spheres and muscles

* Kinematics with contact spheres and muscles by default + separated markerset from model files

* update

* Fixed model with muscles and contact spheres

* fixed model with muscles

* Handle approx_time_maxspeed specified once (#160)

handle the case where the approx_time_maxspeed is only specified once for multiple cameras, add a log to warn when the synch frame range goes out of the pose frame range and check if there's enough sample for filtering

* Fixed clicking board for extrinsics issue

* frame_range was wrong on the pose estimation pbar

* minor typos

* fixed body_25 markers

* larger RoM for wrist and body_25 fix

* Removed qt5agg matplotlib backend

* bump to v0.10.10

* Clamped arm dofs (for Sports2D)

* bumped to v0.10.12

* rolled back to former joint limits, fixed head and lumbar vertebraes scaling, fixed global mass given once, let user use non rtmlib models

* PR for User Interface of Synchronization

* revert AurelienCoppee's commit and change multi_person logic

* clamped ankle angles

* New pipeline

New pipeline unvisible for the user but will allow future structural rework

* fix

* fix

* fix

* fix

* fix

* Fixed person ID not passed + various small edits

* synchronization_gui=true by default in multiperson cases

* bump to v0.10.14

* Update synchronization instructions

* Increased image width

* Added Discord badge

* Edited discord link

* Discord badge

* Add files via upload

* Add files via upload

* Add files via upload

* Add files via upload

* Delete GUI/tutorial/tutorial_step1.mp4

* Delete GUI/tutorial/tutorial_step2.mp4

* Delete GUI/tutorial/tutorial_step3.mp4

* Delete GUI/tutorial/tutorial_step4.mp4

* Add files via upload

Beta version of GUI

---------

Co-authored-by: HunMinKim <[email protected]>
Co-authored-by: davidpagnon <[email protected]>
Co-authored-by: HunMinKim <[email protected]>
Co-authored-by: Laizo <[email protected]>
@davidpagnon
Copy link
Collaborator Author

davidpagnon commented May 11, 2025

Thanks Yacine for this great work!
This is quite close to a version we can publish :)
I edited a few things, and I have a few other suggestions:

What I did:

  • Run as CLI: Launch the GUI by running the command Pose2Sim from anywhere on your computer (I just added it as a script in pyproject.toml, and edited the imports a little). The exe file can also be found in C:\Users\USERNAME\miniconda3\Scripts.
  • Missing dependencies: I added customtkinter and requests in the dependencies. I did not add tomlkit though, as I'd rather keep working with toml, so I replaced all the occurrences of tomlkit.
  • Link to files rather than copying them: Instead of copying the videos and various files, which could very quickly add up storage space, I created a symbolic link to the original files.
  • Imported config from library: Instead of hardcoding the whole configuration to the python file, I loaded it from Pose2Sim or Sports2D (with Path(Pose2Sim.__file__).parent / 'Demo_SinglePerson' / 'Config.toml'). There are several occurrences where the configuration options are hardcoded: eventually, it would be nice to get them directly from the default calibration file, since the configuration file will probably evolve with time and maintaining the GUI would become complicated.
  • Enabled other pose estimation models
  • Merged HunMin's intro screen, slightly changed the timings. Could not find a way to fix the error: "invalid command name "2568299333440update" while executing "2568299333440update" ("after" script)"
  • Removed GUI.py
  • Replaced a large part of the os occurrences with Path from the pathlib library, which is more modern. I did not do app.py, blur.py, utils.py. Evertually, I'd like to replace them all, including in the core package. Also removed some imports that were not used
  • Used subprocess instead of os.system + start, in order to run cross-platform

@davidpagnon
Copy link
Collaborator Author

davidpagnon commented May 11, 2025

My suggestions, now. I did not reread it, so feel free to tell me if anything is unclear!

My suggestions:

General:

  • Some Config parameters from the newer Pose2Sim and Sports2D version are missing. For Sports2D, it makes the analysis fail.
  • Since we are picking the files by hand, I do not think it is necessary for the user to specify file extensions
  • Would be nice to have buttons a bit more descriptive than "Proceed with...", and a bit fewer pop-up windows. I'm giving you an example in the Calibration section
  • It would also be nice to add a green "Next" button that sends you to the next stage. Even better, there could be a last button that says "Run now" if the user wants to only run calibration or any single stage
  • Some occurrences of the os library still need to be changed to their pathlib equivalent (not important): app.py, blur.py, utils.py

Tutorial:

  • tutorial_preview.png not available
  • Not sure we need both the buttons "skip tutorial" and "complete tutorial"?

Calibration:

  • Cannot edit calibration checkerboard once it has been confirmed
  • When Convert is selected: should not have a number of cameras, and No checkerboard preview
  • Would be good to be able to select multiple files (in the case of images, for example)
  • Instead of the button "Proceed with calibration" which is not very clear, and the popup window that says "Please select the checkerboard etc", you could only have more buttons, for example Intrinsics: "Select checkerboard images/videos" and Extrinsics "Select scene images" and "Define scene coordinates"
  • Scene point selection: I think it would be good to either have a popup window with (X, Y, Z) fields right after each click, or one single window with one line per point, with three (X, Y, Z) columns

Prepare videos:

  • I'm not entirely sure why we need two modes. Here is what I suggest, but feel free to tell me if I missed something:
    • Simple mode is only useful to extract checkerboard images, right? If so, it could be an option in the previous Calibration tab
    • Advanced mode is great (although I have not fully tested it), but in most cases, the user won't need it. What about renaming the tab "Edit videos (optional)
  • I think the sections should be more obvious:: File operations, Drawing, Cropping, Rotation, Face Detection. There problem right now is that the shubsections (shape list, for example) are at the same level as the main ones.
  • Do we need the shapes to have an outline color? I feel like they could just be dashed lines.
  • Do we need the buttons "Enable ..." (video cropping, rotation, etc)?
  • You could also use the new face_bluring.py tool for automatically bluring faces (I would actually put it at the very top, as it might be the most used tool in the future)
  • the pixelation effect could be stronger
  • I got a few bugs, I hope it is not me, but it is entirely possible that I messed up with your files:
    • Prepare video -> Only checkerboard images ->
      File "D:\softs\github_david\pose2sim\GUI\tabs\prepare_video_tab.py", line 340, in confirm_checkerboard_only
      for widget in self.frame.winfo_descendants():
      AttributeError: 'CTkFrame' object has no attribute 'winfo_descendants'
    • Upon lauching video editor:
      File "D:\softs\github_david\pose2sim\GUI\tabs\prepare_video_tab.py", line 340, in confirm_checkerboard_only
      for widget in self.frame.winfo_descendants():
      AttributeError: 'CTkFrame' object has no attribute 'winfo_descendants'
      Error initializing RTMPose:

Data visualization:

  • TRC plot: In case it can help, have a look at this:
    • The scale is adjusted at each time frame. It would be better to scale it from the maximum X,Y,Z values across all frames
    • The scales are not equal on the X,Y,Z axes, which makes the bodies deform at times
    • Axes are not in the right order. 3D coordinates (X forward, Y left, Z up) becomes in the TRC frame of reference (X left, Y up, Z forward), and in Blender (X right, Y forward, Z up)
  • A controlable timeline would be great

Not sure how to go about it, but it would be nice to integrate Mstudio, too

@davidpagnon
Copy link
Collaborator Author

I made a first attempt at making a one-click install. I haven't fully tested it yet, but basically, here is what I want:

  • To create the installer, run this command line:
    pyinstaller --onefile --name Pose2SimInstaller --windowed --icon=GUI/assets/pose2sim_logo.ico pose2sim_installer.py.
    This creates a Pose2SimInstaller.exe file.
  • Double-click this file to launch an installer GUI (or not if you add the argument --console). This will automatically install conda, python, and the pose2sim libraries.
  • Once installed, a Pose2Sim.exe script is created on the desktop, that launches the actual GUI from Yacine.

image

However:

  • It needs to be fully tested (I haven't even tried to finish the installation)
  • It would be even greater if we updated the .github/workflows/publish_on_release.yml script so that it automatically creates a new installer upon each release, saves it in the dist folder, that users could directly download

- Reproject hidden points too
- Confirmation window after each labeled image
Added "requests" package to requirements
- added an option to calibrate with a vertical checkerboard
- save images with reprojected points

Fixed edge cases:
- handles trimmed_mean function failure (when computing height and scaling)
- fixed frame range issues in pose estimation, triangulation, filtering, marker augmentation
- handled cases when no videos found for synchronization GUI and fps determination
@davidpagnon
Copy link
Collaborator Author

Calibration:

  • added an option to calibrate with a vertical checkerboard
  • save images with reprojected points

Fixed edge cases:

  • handles trimmed_mean function failure (when computing height and scaling)
  • fixed frame range issues in pose estimation, triangulation, filtering, marker augmentation
  • handled cases when no videos found for synchronization GUI and fps determination

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants