hkair / Basketball-Action-Recognition

Spatio-Temporal Classification of 🏀 Basketball Actions using 3D-CNN Models on the SpaceJam Dataset.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Problems I met & record for solution

GromShine opened this issue · comments

Belowing is some problems I met and trying to solve to help me run the code

Dear author,
I download your repo and find always bugs, and don't know how to start at first, bellowing is the record of my attempts

  1. I download yolo3.cfg & yolo3.weights in main folder
  2. I download the dataset.zip in https://github.com/simonefrancia/SpaceJam and unzip it into main folder.
  3. I run the main.py, and selecting a rectangle and then it told me '[Errno 2] No such file or directory: 'model_checkpoints/r2plus1d_augmented-2/r2plus1d_multiclass_19_0.0001.pt''
  4. and I think maybe I should run train.py at first to get the above 'r2plus1d_multiclass', but it told me [Errno 2] No such file or directory: 'dataset/augmented_annotation_dict.json'
  5. and I think maybe I should run augment_video.py at first to get 'augmented_annotation_dict.json', but it told me
    Traceback (most recent call last):

File "D:\Basketball-Action-Recognition\augment_videos.py", line 128, in
augmentVideo(annotation_dict, labels_dict)

File "D:\Basketball-Action-Recognition\augment_videos.py", line 23, in augmentVideo
labels_dict = json.load(f, object_hook=keystoint)

File "D:\anaconda3\envs\pymarl\lib\json_init.py", line 296, in load_
parse_constant=parse_constant, object_pairs_hook=object_pairs_hook, **kw)

File "D:\anaconda3\envs\pymarl\lib\json_init.py", line 361, in loads_
return cls(**kw).decode(s)

File "D:\anaconda3\envs\pymarl\lib\json\decoder.py", line 337, in decode
_obj, end = self.raw_decode(s, idx=w(s, 0).end())

File "D:\anaconda3\envs\pymarl\lib\json\decoder.py", line 353, in raw_decode
obj, end = self.scan_once(s, idx)

JSONDecodeError: Expecting property name enclosed in double quotes

after above,

  1. I modify the dataset\labels_dict.json to make sure the key is double quotes and I get the 'augmented_annotation_dict.json'
  2. Then I run the train.py, it seems will train abt 1 hour, I ll update then
    it seems 1 epoch 1 hour, 25 epoch... seems I ll update tomorrow...
    after 1 epoch, I have 'model_checkpoints/r2plus1d_augmented-2/r2plus1d_multiclass_1_0.0001.pt', seems different from the above 'model_checkpoints/r2plus1d_augmented-2/r2plus1d_multiclass_19_0.0001.pt', maybe I should wait it 19 epoch
    ★attention, you should reserve 341M*25 ≈ 8.3G space to save them
  3. now I have r2plus1d_multiclass_1_0.0001.pt~r2plus1d_multiclass_1_0.0024.pt, and it told me
    Training complete in 1466m 17s
    Best val Acc: 0.854709
    Best Validation Loss: 0.45085233312969436 Epoch: 3
    Best Training Loss: 0.022664556910204244 Epoch: 23
    Traceback (most recent call last):
    File "D:\Basketball-Action-Recognition\train.py", line 343, in
    plot_epoch

File "D:\Basketball-Action-Recognition\utils\checkpoints.py", line 88, in plot_curves
plt.plot(epochs, train_acc, label='train accuracy')

File "D:\anaconda3\envs\pymarl\lib\site-packages\matplotlib\pyplot.py", line 2759, in plot
**({"data": data} if data is not None else {}), **kwargs)

_ File "D:\anaconda3\envs\pymarl\lib\site-packages\matplotlib\axes_axes.py", line 1632, in plot_
_lines = [*self.get_lines(*args, data=data, **kwargs)]

_File "D:\anaconda3\envs\pymarl\lib\site-packages\matplotlib\axes_base.py", line 312, in call
_yield from self.plot_args(this, kwargs)

_ File "D:\anaconda3\envs\pymarl\lib\site-packages\matplotlib\axes_base.py", line 488, in plot_args
_y = check_1d(xy[1])

File "D:\anaconda3\envs\pymarl\lib\site-packages\matplotlib\cbook_init.py", line 1304, in check_1d
return np.atleast_1d(x)

File "<array_function internals>", line 6, in atleast_1d

File "D:\anaconda3\envs\pymarl\lib\site-packages\numpy\core\shape_base.py", line 65, in atleast_1d
ary = asanyarray(ary)

File "D:\anaconda3\envs\pymarl\lib\site-packages\torch_tensor.py", line 678, in array
return self.numpy()

TypeError: can't convert cuda:0 device type tensor to numpy. Use Tensor.cpu() to copy the tensor to host memory first.

  1. I create 'output_videos' folder in main folder, then I run main.py and select some rectangle, I get an output video as a result
  2. ★so now if I want to have everyone's action recognition, I need to rectangle them one by one
commented

Dear sir, I have suffered the same process as you posted. I put my test mp4 video in videos folder. But after I run main.py, I got an mp4 file that cannot be opened. How to get the correct result?