HHTseng / video-classification

Tutorial for video classification/ action recognition using 3D CNN/ CNN+RNN on UCF101
916 stars 216 forks source link

TypeError: Singleton array array(67, dtype=int64) cannot be considered a valid collection. #45

Open TK-cosc opened 3 years ago

TK-cosc commented 3 years ago

Hi,When I was running UCF101_3DCNN.py, I got the following error: ...... File "...... .\lib\site-packages\sklearn\metrics\classification.py", line 71, in _check_targets check_consistent_length(y_true, y_pred) File "...... .\lib\site-packages\sklearn\utils\validation.py", line 200, in _check_consistent_length lengths=[_num_samples(X) for X in arrays if X is not None] File "...... .\lib\site-packages\sklearn\utils\validation.py", line 200, in lengths=[_num_samples(X) for X in arrays if X is not None] File "...... .\lib\site-packages\sklearn\utils\validation.py", line 119, in _num_samples " a valid collection." % x) TypeError: Singleton array array(67, dtype=int64) cannot be considered a valid collection.

The batch_size is resized as 5, 10, 15, 45, 60, 100, ...... respectively, but this issue exists yet.

TK-cosc commented 3 years ago

array([ ])

striver6 commented 3 years ago

array([ ])

Hi,did you solve the issue? I meet the same ploblem.Thanks.

CAbrook commented 3 years ago

array([ ])

Hi,did you solve the issue? I meet the same ploblem.Thanks.

May I ask if you have solved it now? I also met the same problem

TK-cosc commented 3 years ago

UCF101_3DCNN.py line 59

step_score = accuracy_score([y.cpu().data.squeeze().numpy()], [y_pred.cpu().data.squeeze().numpy()])

the parameters of accuracy_score() need to be array-like etc., so the correction is likes to the above line.

please let me receive your reply if you solve the problem.

Regards!

At 2021-03-12 22:05:12, "CAbrook" @.***> wrote:

array([ ])

Hi,did you solve the issue? I meet the same ploblem.Thanks.

May I ask if you have solved it now? I also met the same problem

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or unsubscribe.

TK-cosc commented 3 years ago

UCF101_3DCNN.py line 59

step_score = accuracy_score([y.cpu().data.squeeze().numpy()], [y_pred.cpu().data.squeeze().numpy()])

the parameters of accuracy_score() need to be array-like etc., so the correction is likes to the above line.

please let me receive your reply if you solve the problem.

Regards!

At 2021-02-06 18:57:07, "striver6" @.***> wrote:

array([ ])

Hi,did you solve the issue? I meet the same ploblem.Thanks.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or unsubscribe.

mmmmlz commented 3 years ago

check if you use CPU ,the BatchSize =1 will cause this problem

medicalsure commented 3 years ago

check if you use CPU ,the BatchSize =1 will cause this problem

So using GPU will solve this problem?

guohaoyu110 commented 3 years ago

check if you use CPU ,the BatchSize =1 will cause this problem

So using GPU will solve this problem?

not necessary, just add [ ] because this is needed in sklearn.

TK-cosc commented 2 years ago

yes.

At 2021-05-19 17:33:29, "medicalsure" @.***> wrote:

check if you use CPU ,the BatchSize =1 will cause this problem

So using GPU will solve this problem?

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or unsubscribe.