ArtLabss / tennis-tracking

Open-source Monocular Python HawkEye for Tennis
https://www.artlabs.tech
The Unlicense
392 stars 95 forks source link

Bouncing point #29

Open 5urabhi opened 1 year ago

5urabhi commented 1 year ago

Hey i wanted to know how does you predict the bouncing point of the ball so correctly. I was trying to understand your code to implement something similar to your bounce detection. I understand the part where you are saving x, y and v data in csv format and you are using pretrained model to detect the bounce but i am unable to understand how does this part of the code works: Xs = test_df[['lagX_20', 'lagX_19', 'lagX_18', 'lagX_17', 'lagX_16', 'lagX_15', 'lagX_14', 'lagX_13', 'lagX_12', 'lagX_11', 'lagX_10', 'lagX_9', 'lagX_8', 'lagX_7', 'lagX_6', 'lagX_5', 'lagX_4', 'lagX_3', 'lagX_2', 'lagX_1']] Xs = from_2d_array_to_nested(Xs.to_numpy()) can you please explain in detail.

shukkkur commented 1 year ago

@5urabhi Hi!

Please refer to the following issues:

The part of the code you mentioned is from sktime library

5urabhi commented 1 year ago

Hey I tried to run your code with bounce=1 and minimap =1 getting error: File "/content/drive/MyDrive/Tennis-T-D/predict_video.py", line 342, in predcted = clf.predict(X) File "/usr/local/lib/python3.9/dist-packages/sklearn/pipeline.py", line 480, in predict Xt = transform.transform(Xt) File "/usr/local/lib/python3.9/dist-packages/sktime/transformations/base.py", line 533, in transform X_inner, y_inner, metadata = self._check_X_y(X=X, y=y, return_metadata=True) File "/usr/local/lib/python3.9/dist-packages/sktime/transformations/base.py", line 943, in _check_X_y raise TypeError("X " + msg_invalid_input) TypeError: X must be in an sktime compatible format, of scitype Series, Panel or Hierarchical, for instance a pandas.DataFrame with sktime compatible time indices, or with MultiIndex and last(-1) level an sktime compatible time index. Allowed compatible mtype format specifications are: ['pd.Series', 'pd.DataFrame', 'np.ndarray', 'nested_univ', 'numpy3D', 'pd-multiindex', 'df-list', 'pd_multiindex_hier'] . See the data format tutorial examples/AA_datatypes_and_datasets.ipynb. If you think the data is already in an sktime supported input format, run sktime.datatypes.check_raise(data, mtype) to diagnose the error, where mtype is the string of the type specification you want. Error message for checked mtypes, in format [mtype: message], as follows: [pd.DataFrame: X must have unique column indices, but found Int64Index([0, 0, 0], dtype='int64')] [pd.Series: X must be a pandas.Series, found <class 'pandas.core.frame.DataFrame'>] [np.ndarray: X must be a numpy.ndarray, found <class 'pandas.core.frame.DataFrame'>] [xr.DataArray: X must be a xarray.DataArray, found <class 'pandas.core.frame.DataFrame'>] [dask_series: X must be a dask DataFrame, found <class 'pandas.core.frame.DataFrame'>] [df-list: X must be list of pd.DataFrame, found <class 'pandas.core.frame.DataFrame'>] [numpy3D: X must be a numpy.ndarray, found <class 'pandas.core.frame.DataFrame'>] [pd-multiindex: X must have a MultiIndex, found <class 'pandas.core.indexes.range.RangeIndex'>] [nested_univ: X must have unique column indices, but found Int64Index([0, 0, 0], dtype='int64')] [dask_panel: X must be a dask DataFrame, found <class 'pandas.core.frame.DataFrame'>] [pd_multiindex_hier: X must have a MultiIndex, found <class 'pandas.core.indexes.range.RangeIndex'>] [dask_hierarchical: X must be a dask DataFrame, found <class 'pandas.core.frame.DataFrame'>] [ ] can you help me in this.