yastrebksv / TennisProject

Tennis analysis using deep learning and machine learning
101 stars 24 forks source link

what happen #3

Closed chen9544827 closed 2 months ago

chen9544827 commented 7 months ago

Traceback (most recent call last): File "main.py", line 156, in homography_matrices, kps_court = court_detector.infer_model(frames) File "C:\Users\Aa954\OneDrive\桌面\tennis_bound\TennisProject-main\TennisProject-main\court_detection_net.py", line 50, in infer_model matrix_trans = get_trans_matrix(points) File "C:\Users\Aa954\OneDrive\桌面\tennis_bound\TennisProject-main\TennisProject-main\homography.py", line 34, in get_trans_matrix dists.append(distance.euclidean(points[i], trans_kps[i])) File "C:\Users\Aa954\anaconda3\envs\TtackNet\lib\site-packages\scipy\spatial\distance.py", line 520, in euclidean return minkowski(u, v, p=2, w=w) File "C:\Users\Aa954\anaconda3\envs\TtackNet\lib\site-packages\scipy\spatial\distance.py", line 464, in minkowski v = _validate_vector(v) File "C:\Users\Aa954\anaconda3\envs\TtackNet\lib\site-packages\scipy\spatial\distance.py", line 302, in _validate_vector raise ValueError("Input vector should be 1-D.") ValueError: Input vector should be 1-D. I don't how to solve 。please give me answer,thanks。

mafiat commented 6 months ago

I have the same issue. Any thoughts

yastrebksv commented 6 months ago

It seems that something went wrong with points after applying homography matrix. Could you send me video fragment or one image where the error occured?

mafiat commented 6 months ago

I got it fixed it @yastrebksv !

What i did was to change the homography.py, on line 28 by adding .squeeze at the end.

trans_kps = cv2.perspectiveTransform(refer_kps, matrix).squeeze(1)

Do you concur?

chricarp commented 6 months ago

@mafiat can confirm, this solved the issue also for me

yastrebksv commented 2 months ago

@mafiat Confirm, thank you!