masouduut94 / volleyball_analytics

This project is designed to display how we can utilize deep learning methods for Sports Data Analytics.
GNU General Public License v2.0
18 stars 3 forks source link

Missing weights #2

Closed markusmagomedov closed 5 months ago

markusmagomedov commented 5 months ago

markusmagomedov@Markuss-MacBook-Air-3 volleyball_analytics % python3.11 src/demo.py /Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/torchvision/transforms/functional_tensor.py:5: UserWarning: The torchvision.transforms.functional_tensor module is deprecated in 0.15 and will be **removed in 0.17**. Please don't rely on it. You probably just need to use APIs in torchvision.transforms.functional or in torchvision.transforms.v2.functional. warnings.warn( 2024-04-01 20:15:37.370 | INFO | src.utilities.utils:info:651 - Configs initialized successfully. Initializing model and transforms... Traceback (most recent call last): File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/transformers/utils/hub.py", line 389, in cached_file resolved_file = hf_hub_download( ^^^^^^^^^^^^^^^^ File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/huggingface_hub/utils/_validators.py", line 110, in _inner_fn validate_repo_id(arg_value) File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/huggingface_hub/utils/_validators.py", line 158, in validate_repo_id raise HFValidationError( huggingface_hub.utils._validators.HFValidationError: Repo id must be in the form 'repo_name' or 'namespace/repo_name': '/home/masoud/Desktop/projects/volleyball_analytics/weights/game-state/3-states/checkpoint'. Userepo_type` argument if needed.

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

Traceback (most recent call last): File "/Users/user1/volleyball_analytics/src/demo.py", line 60, in state_detector = GameStateDetector(cfg=model_cfg['video_mae']['game_state_3']) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/Users/user1/volleyball_analytics/src/ml/video_mae/game_state/gamestate_detection.py", line 22, in init self.feature_extractor = VideoMAEImageProcessor.from_pretrained(ckpt) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/transformers/image_processing_utils.py", line 203, in from_pretrained image_processor_dict, kwargs = cls.get_image_processor_dict(pretrained_model_name_or_path, **kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/transformers/image_processing_utils.py", line 332, in get_image_processor_dict resolved_image_processor_file = cached_file( ^^^^^^^^^^^^ File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/transformers/utils/hub.py", line 454, in cached_file raise EnvironmentError( OSError: Incorrect path_or_model_id: '/home/masoud/Desktop/projects/volleyball_analytics/weights/game-state/3-states/checkpoint'. Please provide either the path to a local folder or the repo_id of a model on the Hub.`

Maybe the model should be installed by default since im not sure how to do it? Also for some reason python doesnt import the src folder so adding import sys sys.path.insert(0, '/Users/user1/volleyball_analytics') at the start of the file fixes it for me. This would be different for each person

masouduut94 commented 5 months ago

Please have a look at the readme file again. I explained how to set up the weights. I know that setting up the project is a little complicated at times. I'm going to make it more simple.

here I copy paste the instruction that I just added to the project:

Open the conf/ml_models.yaml, and configure it this way:

yolo:
  player_segmentation:
    weight: "path/to/weights" # download: https://github.com/ultralytics/assets/releases/download/v8.1.0/yolov8n-seg.pt
    labels: {0: 'person'}
  player_detection:
    weight: "path/to/weights" # download: https://github.com/ultralytics/assets/releases/download/v8.1.0/yolov8n.pt
    labels: {0: 'person'}
  pose_estimation:
    weight: "path/to/weights" # download: https://github.com/ultralytics/assets/releases/download/v8.1.0/yolov8n-pose.pt
    labels: {0: 'person'}
  ball_segmentation:
    weight: "path/to/weights" # download: https://drive.google.com/file/d/1KXDunsC1ALOObb303n9j6HHO7Bxz1HR_/view?usp=sharing
    labels: {0: "ball"}
  action_detection6:
    weight: "/path/to/weights" # download: https://drive.google.com/file/d/1o-KpRVBbjrGbqlT8tOjFv91YS8LIJZw2/view?usp=sharing
    labels: { 0: 'ball', 1: 'block', 2: "receive", 3: 'set', 4: 'spike', 5: 'serve'}
  court_segment:
    weight: "/path/to/weights.pt" # donwload link: https://drive.google.com/file/d/1bShZ7hxNw_AESEgKf_EyoBXdFqCuL7V-/view?usp=sharing
    labels: { 0: "court"}

video_mae:
  game_state_3:
    weight: "/path/to/checkpoint directory" # download: https://drive.google.com/file/d/18vtJSLIpaRHOlvXNmwvSd9stYYAEsMcK/view?usp=sharing

For more information about datasets and weights, please have a look at the wiki page here:

markusmagomedov commented 5 months ago

Oh really sorry, dont know how I missed it since I always read the readme files. I’ll try setting them up when I get home!

masouduut94 commented 5 months ago

Hi again Markus.

Im reaching to know if you were able to run the script or not?

Please let me know if there were any issues.

Thanks

On Tue, Apr 2, 2024, 8:02 AM Markus Magomedov @.***> wrote:

Oh really sorry, dont know how I missed it since I always read the readme files. I’ll try setting them up when I get home!

— Reply to this email directly, view it on GitHub https://github.com/masouduut94/volleyball_analytics/issues/2#issuecomment-2031066351, or unsubscribe https://github.com/notifications/unsubscribe-auth/AFB4FCDJGUSNKYSK4W4ROU3Y3IYHDAVCNFSM6AAAAABFR5CQJCVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDAMZRGA3DMMZVGE . You are receiving this because you commented.Message ID: @.***>

markusmagomedov commented 5 months ago

Yes, everything is now working!