TrackNet-Badminton-Tracking-tensorflow2 icon indicating copy to clipboard operation
TrackNet-Badminton-Tracking-tensorflow2 copied to clipboard

image labeling question

Open wei-m-teh opened this issue 3 years ago • 8 comments

Hi, I followed the steps outlined in the README to perform labeling for the video frames, and would like to validate the labeled dataset to make sure they are done correctly. I ran video2img.py script with test.csv and test.mp4 provided in this repo, and saw both x_data and y_data jpg files in the train_data/match1 folder. So far so good. However, when I open the jpg file in y_data folder, I observed the white point (produced through heatmap function) doesn't align with the ball in the corresponding jpg file in x_data. For some reason, the white point occurs at the top left corner of the jpg. I even tried running video2img.py script passing HEIGHT and WIDTH (720, 1080) matching the original size but the result is the same. I observed the similar output pattern with my own dataset. Any idea why this is hapenning, and any suggestions on how to fix it? Thanks!

wei-m-teh avatar Jul 29 '21 14:07 wei-m-teh

I met exactlly the same problem. Have you figure out is this situation normal or unnormal?

clover978 avatar Sep 08 '21 06:09 clover978

Hi guys!

I've been looking at this code too, as I had the same problem. I think that these lines (47-48): else: heat_map = genHeatMap(WIDTH, HEIGHT, int(label[2]/ratio), int(label[3]/ratio), sigma, mag)

Should actually be: else: heat_map = genHeatMap(WIDTH, HEIGHT, int(label[2]*WIDTH/ratio), int(label[3]*HEIGHT/ratio), sigma, mag)

Otherwise, converting the fractional part from imgLabe into an int makes it always equal to 1,1 . Training is working well, haven't tried predict yet.

This is in video2img btw

alexandrepdumont avatar Sep 09 '21 23:09 alexandrepdumont

Hi, @alexandrepdumont

To my understanding, for the dataset downloaded from original repo , the code is correct. heat_map = genHeatMap(WIDTH, HEIGHT, int(label[2]/ratio), int(label[3]/ratio), sigma, mag)

For dataset generated by imgLabel.py, I think the code should be modified to: heat_map = genHeatMap(WIDTH, HEIGHT, int(label[2]*WIDTH), int(label[3]*HEIGHT), sigma, mag) (Notice that my modification is not the same with yours.)

Anyway, what we need to do is making x_data correspond with y_data.

clover978 avatar Sep 10 '21 00:09 clover978

Yes you are quite right, I took out the ratio on subsequent training, as all it did as far as I saw was expand the images into 2.5x the original image. Not sure why this would be desirable. I've taken out all the ratios in predict.py as well so that it matches with the training.

alexandrepdumont avatar Sep 10 '21 01:09 alexandrepdumont

The training is still in progress.

But I don't think the eleluation result is quiet normal. The accuracy become 0.74 in the very beginning and start to zigzag.

==========Epoch 0 start validation==========
Epoch 0 accuracy: 0.644
Epoch 0 precision: 0.981
Epoch 0 recall: 0.597
Epoch 0 average = (accuracy + precision + recall)/3: 0.741
==========Epoch 1 start validation==========
Epoch 1 accuracy: 0.786
Epoch 1 precision: 0.944
Epoch 1 recall: 0.799
Epoch 1 average = (accuracy + precision + recall)/3: 0.843
==========Epoch 2 start validation==========
Epoch 2 accuracy: 0.577
Epoch 2 precision: 0.982
Epoch 2 recall: 0.521
Epoch 2 average = (accuracy + precision + recall)/3: 0.693
==========Epoch 3 start validation==========
Epoch 3 accuracy: 0.816
Epoch 3 precision: 0.980
Epoch 3 recall: 0.799
Epoch 3 average = (accuracy + precision + recall)/3: 0.865
==========Epoch 4 start validation==========
Epoch 4 accuracy: 0.662
Epoch 4 precision: 0.977
Epoch 4 recall: 0.627
Epoch 4 average = (accuracy + precision + recall)/3: 0.755
==========Epoch 5 start validation==========
Epoch 5 accuracy: 0.699
Epoch 5 precision: 0.982
Epoch 5 recall: 0.676
Epoch 5 average = (accuracy + precision + recall)/3: 0.785
==========Epoch 6 start validation==========
Epoch 6 accuracy: 0.791
Epoch 6 precision: 0.978
Epoch 6 recall: 0.782
Epoch 6 average = (accuracy + precision + recall)/3: 0.850
==========Epoch 7 start validation==========
Epoch 7 accuracy: 0.825
Epoch 7 precision: 0.915
Epoch 7 recall: 0.868
Epoch 7 average = (accuracy + precision + recall)/3: 0.870
==========Epoch 8 start validation==========
Epoch 8 accuracy: 0.778
Epoch 8 precision: 0.959
Epoch 8 recall: 0.776
Epoch 8 average = (accuracy + precision + recall)/3: 0.837
==========Epoch 9 start validation==========
Epoch 9 accuracy: 0.660
Epoch 9 precision: 0.975
Epoch 9 recall: 0.628
Epoch 9 average = (accuracy + precision + recall)/3: 0.754
==========Epoch 10 start validation==========
Epoch 10 accuracy: 0.631
Epoch 10 precision: 0.990
Epoch 10 recall: 0.576
Epoch 10 average = (accuracy + precision + recall)/3: 0.732
==========Epoch 11 start validation==========
Epoch 11 accuracy: 0.857
Epoch 11 precision: 0.962
Epoch 11 recall: 0.864
Epoch 11 average = (accuracy + precision + recall)/3: 0.894
==========Epoch 12 start validation==========
Epoch 12 accuracy: 0.766
Epoch 12 precision: 0.964
Epoch 12 recall: 0.758
Epoch 12 average = (accuracy + precision + recall)/3: 0.829
==========Epoch 13 start validation==========
Epoch 13 accuracy: 0.733
Epoch 13 precision: 0.970
Epoch 13 recall: 0.723
Epoch 13 average = (accuracy + precision + recall)/3: 0.809
==========Epoch 14 start validation==========
Epoch 14 accuracy: 0.787
Epoch 14 precision: 0.979
Epoch 14 recall: 0.763
Epoch 14 average = (accuracy + precision + recall)/3: 0.843
==========Epoch 15 start validation==========
Epoch 15 accuracy: 0.843
Epoch 15 precision: 0.960
Epoch 15 recall: 0.853
Epoch 15 average = (accuracy + precision + recall)/3: 0.885

I use original repo's dataset and all hyperpararmeter unchanged.

clover978 avatar Sep 10 '21 01:09 clover978

Yeah in doing the same on a tennis serve from Federer and the results are just not great at all, in fact, I'm pretty certain that i need to do something more on the predict so that the outputs are exactly the same as my training data, I'll look at this tomorrow.

On Thu, Sep 9, 2021, 21:08 clover978 @.***> wrote:

The training is in progress for me.

But I don't think the eleluation result is quiet normal. The accuracy become 0.74 in the very beginning and start to zigzag.

==========Epoch 0 start validation========== Epoch 0 accuracy: 0.644 Epoch 0 precision: 0.981 Epoch 0 recall: 0.597 Epoch 0 average = (accuracy + precision + recall)/3: 0.741 ==========Epoch 1 start validation========== Epoch 1 accuracy: 0.786 Epoch 1 precision: 0.944 Epoch 1 recall: 0.799 Epoch 1 average = (accuracy + precision + recall)/3: 0.843 ==========Epoch 2 start validation========== Epoch 2 accuracy: 0.577 Epoch 2 precision: 0.982 Epoch 2 recall: 0.521 Epoch 2 average = (accuracy + precision + recall)/3: 0.693 ==========Epoch 3 start validation========== Epoch 3 accuracy: 0.816 Epoch 3 precision: 0.980 Epoch 3 recall: 0.799 Epoch 3 average = (accuracy + precision + recall)/3: 0.865 ==========Epoch 4 start validation========== Epoch 4 accuracy: 0.662 Epoch 4 precision: 0.977 Epoch 4 recall: 0.627 Epoch 4 average = (accuracy + precision + recall)/3: 0.755 ==========Epoch 5 start validation========== Epoch 5 accuracy: 0.699 Epoch 5 precision: 0.982 Epoch 5 recall: 0.676 Epoch 5 average = (accuracy + precision + recall)/3: 0.785 ==========Epoch 6 start validation========== Epoch 6 accuracy: 0.791 Epoch 6 precision: 0.978 Epoch 6 recall: 0.782 Epoch 6 average = (accuracy + precision + recall)/3: 0.850 ==========Epoch 7 start validation========== Epoch 7 accuracy: 0.825 Epoch 7 precision: 0.915 Epoch 7 recall: 0.868 Epoch 7 average = (accuracy + precision + recall)/3: 0.870 ==========Epoch 8 start validation========== Epoch 8 accuracy: 0.778 Epoch 8 precision: 0.959 Epoch 8 recall: 0.776 Epoch 8 average = (accuracy + precision + recall)/3: 0.837 ==========Epoch 9 start validation========== Epoch 9 accuracy: 0.660 Epoch 9 precision: 0.975 Epoch 9 recall: 0.628 Epoch 9 average = (accuracy + precision + recall)/3: 0.754 ==========Epoch 10 start validation========== Epoch 10 accuracy: 0.631 Epoch 10 precision: 0.990 Epoch 10 recall: 0.576 Epoch 10 average = (accuracy + precision + recall)/3: 0.732 ==========Epoch 11 start validation========== Epoch 11 accuracy: 0.857 Epoch 11 precision: 0.962 Epoch 11 recall: 0.864 Epoch 11 average = (accuracy + precision + recall)/3: 0.894 ==========Epoch 12 start validation========== Epoch 12 accuracy: 0.766 Epoch 12 precision: 0.964 Epoch 12 recall: 0.758 Epoch 12 average = (accuracy + precision + recall)/3: 0.829 ==========Epoch 13 start validation========== Epoch 13 accuracy: 0.733 Epoch 13 precision: 0.970 Epoch 13 recall: 0.723 Epoch 13 average = (accuracy + precision + recall)/3: 0.809 ==========Epoch 14 start validation========== Epoch 14 accuracy: 0.787 Epoch 14 precision: 0.979 Epoch 14 recall: 0.763 Epoch 14 average = (accuracy + precision + recall)/3: 0.843 ==========Epoch 15 start validation========== Epoch 15 accuracy: 0.843 Epoch 15 precision: 0.960 Epoch 15 recall: 0.853 Epoch 15 average = (accuracy + precision + recall)/3: 0.885

I use original repo's dataset and all hyperpararmeter unchanged.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/Chang-Chia-Chi/TrackNet-Badminton-Tracking-tensorflow2/issues/8#issuecomment-916553684, or unsubscribe https://github.com/notifications/unsubscribe-auth/APFHTBRSUH5QQJQ5OUFQ7KTUBFLBVANCNFSM5BGTL3TQ . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.

alexandrepdumont avatar Sep 10 '21 01:09 alexandrepdumont

Yes you are quite right, I took out the ratio on subsequent training, as all it did as far as I saw was expand the images into 2.5x the original image. Not sure why this would be desirable. I've taken out all the ratios in predict.py as well so that it matches with the training.

Maybe to make the output video resolution correspond with input. If you drop all ratio, output will always be 512*288. Is that right?

clover978 avatar Sep 10 '21 01:09 clover978

Really not sure tbh, but i don't think it's integral to the algorithm

On Thu, Sep 9, 2021, 21:15 clover978 @.***> wrote:

Yes you are quite right, I took out the ratio on subsequent training, as all it did as far as I saw was expand the images into 2.5x the original image. Not sure why this would be desirable. I've taken out all the ratios in predict.py as well so that it matches with the training.

Maybe to make the output video resolution correspond with input. If you drop all ratio, output will always be 512*288. Is that right?

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/Chang-Chia-Chi/TrackNet-Badminton-Tracking-tensorflow2/issues/8#issuecomment-916556597, or unsubscribe https://github.com/notifications/unsubscribe-auth/APFHTBQU72VJC47QFRWEZFTUBFL4BANCNFSM5BGTL3TQ . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.

alexandrepdumont avatar Sep 10 '21 01:09 alexandrepdumont