Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

AttributeError: 'NoneType' object has no attribute 'shape' #42

Open
alvaromartin990 opened this issue May 7, 2022 · 3 comments
Open

Comments

@alvaromartin990
Copy link

Hi,

I am opening an issue here since I am trying to run train_i3d.py, and I keep getting the same error. After trying a few things, it does not work. Here is the error, could anyone help me out please?

[Running] python -u "c:\Users\siste\OneDrive\Desktop\New folder\WLASL-master\WLASL-master\code\I3D\train_i3dVersion2.py"
root {'word': 'C:\\Users\\siste\\OneDrive\\Desktop\\New folder\\archive\\videos'} train_split C:/Users/siste/OneDrive/Desktop/New folder/WLASL-master/WLASL-master/code/I3D/preprocess\nslt_2000.json
types of data run --- config <class 'configs.Config'> mode <class 'str'> root <class 'dict'> save_model <class 'str'> train_split <class 'str'> weights <class 'NoneType'>
bs=6_ups=1_lr=0.0001_eps=0.001_wd=1e-08
Skipped videos:  0
10566
Skipped videos:  0
1414
Step 0/64000
----------
c:\Users\siste\OneDrive\Desktop\New folder\WLASL-master\WLASL-master\code\I3D\train_i3dVersion2.py:118: DeprecationWarning: `[np.int](http://np.int/)` is a deprecated alias for the builtin `int`. To silence this warning, use `int` by itself. Doing this will not modify any behavior and is safe. When replacing `[np.int](http://np.int/)`, you may wish to use e.g. `np.int64` or `np.int32` to specify the precision. If you wish to review your current use, check the release note link for additional information.
Deprecated in NumPy 1.20; for more details and guidance: https://numpy.org/devdocs/release/1.20.0-notes.html#deprecations
  (num_classes, num_classes), dtype=[np.int](http://np.int/))
dataloaders <torch.utils.data.dataloader.DataLoader object at 0x000001F76FEB5790>
Traceback (most recent call last):
  File "c:\Users\siste\OneDrive\Desktop\New folder\WLASL-master\WLASL-master\code\I3D\train_i3dVersion2.py", line 220, in <module>
    run(configs=configs, mode=mode, root=root, save_model=save_model,
  File "c:\Users\siste\OneDrive\Desktop\New folder\WLASL-master\WLASL-master\code\I3D\train_i3dVersion2.py", line 121, in run
    for data in dataloaders[phase]:
  File "C:\Python39\lib\site-packages\torch\utils\data\dataloader.py", line 517, in __next__
    data = self._next_data()
  File "C:\Python39\lib\site-packages\torch\utils\data\dataloader.py", line 557, in _next_data
    data = self._dataset_fetcher.fetch(index)  # may raise StopIteration
  File "C:\Python39\lib\site-packages\torch\utils\data\_utils\fetch.py", line 44, in fetch
    data = [self.dataset[idx] for idx in possibly_batched_index]
  File "C:\Python39\lib\site-packages\torch\utils\data\_utils\fetch.py", line 44, in <listcomp>
    data = [self.dataset[idx] for idx in possibly_batched_index]
  File "c:\Users\siste\OneDrive\Desktop\New folder\WLASL-master\WLASL-master\code\I3D\datasets\nslt_dataset.py", line 191, in __getitem__
    imgs = load_rgb_frames_from_video(
  File "c:\Users\siste\OneDrive\Desktop\New folder\WLASL-master\WLASL-master\code\I3D\datasets\nslt_dataset.py", line 59, in load_rgb_frames_from_video
    w, h, c = img.shape
AttributeError: 'NoneType' object has no attribute 'shape'
@namtc14
Copy link

namtc14 commented May 26, 2022

The error occurs due to the program continues to read frames though it has already reached the end of the video file.
For example, the following video sample is very short, not enough 27 frames to capture: https://www.signingsavvy.com/signs/mp4/7/7169.mp4

I am considering about solution: Check the returned value of VideoCapture.read() function
for offset in range(num): success, img = vidcap.read() if not success: break w, h, c = img.shape
Let's try and share the result

@dxli94
Copy link
Owner

dxli94 commented May 26, 2022

Another common cause is your local copy of the dataset misses some video files. Do you use official WLASL release or download from somewhere? Note that re-distribution of WLASL is strictly prohibited.

@dxli94 dxli94 closed this as completed May 26, 2022
@dxli94 dxli94 reopened this May 26, 2022
@Nehajain1207
Copy link

Hi,

I am opening an issue here since I am trying to run train_i3d.py, and I keep getting the same error. After trying a few things, it does not work. Here is the error, could anyone help me out please?

[Running] python -u "c:\Users\siste\OneDrive\Desktop\New folder\WLASL-master\WLASL-master\code\I3D\train_i3dVersion2.py"
root {'word': 'C:\\Users\\siste\\OneDrive\\Desktop\\New folder\\archive\\videos'} train_split C:/Users/siste/OneDrive/Desktop/New folder/WLASL-master/WLASL-master/code/I3D/preprocess\nslt_2000.json
types of data run --- config <class 'configs.Config'> mode <class 'str'> root <class 'dict'> save_model <class 'str'> train_split <class 'str'> weights <class 'NoneType'>
bs=6_ups=1_lr=0.0001_eps=0.001_wd=1e-08
Skipped videos:  0
10566
Skipped videos:  0
1414
Step 0/64000
----------
c:\Users\siste\OneDrive\Desktop\New folder\WLASL-master\WLASL-master\code\I3D\train_i3dVersion2.py:118: DeprecationWarning: `[np.int](http://np.int/)` is a deprecated alias for the builtin `int`. To silence this warning, use `int` by itself. Doing this will not modify any behavior and is safe. When replacing `[np.int](http://np.int/)`, you may wish to use e.g. `np.int64` or `np.int32` to specify the precision. If you wish to review your current use, check the release note link for additional information.
Deprecated in NumPy 1.20; for more details and guidance: https://numpy.org/devdocs/release/1.20.0-notes.html#deprecations
  (num_classes, num_classes), dtype=[np.int](http://np.int/))
dataloaders <torch.utils.data.dataloader.DataLoader object at 0x000001F76FEB5790>
Traceback (most recent call last):
  File "c:\Users\siste\OneDrive\Desktop\New folder\WLASL-master\WLASL-master\code\I3D\train_i3dVersion2.py", line 220, in <module>
    run(configs=configs, mode=mode, root=root, save_model=save_model,
  File "c:\Users\siste\OneDrive\Desktop\New folder\WLASL-master\WLASL-master\code\I3D\train_i3dVersion2.py", line 121, in run
    for data in dataloaders[phase]:
  File "C:\Python39\lib\site-packages\torch\utils\data\dataloader.py", line 517, in __next__
    data = self._next_data()
  File "C:\Python39\lib\site-packages\torch\utils\data\dataloader.py", line 557, in _next_data
    data = self._dataset_fetcher.fetch(index)  # may raise StopIteration
  File "C:\Python39\lib\site-packages\torch\utils\data\_utils\fetch.py", line 44, in fetch
    data = [self.dataset[idx] for idx in possibly_batched_index]
  File "C:\Python39\lib\site-packages\torch\utils\data\_utils\fetch.py", line 44, in <listcomp>
    data = [self.dataset[idx] for idx in possibly_batched_index]
  File "c:\Users\siste\OneDrive\Desktop\New folder\WLASL-master\WLASL-master\code\I3D\datasets\nslt_dataset.py", line 191, in __getitem__
    imgs = load_rgb_frames_from_video(
  File "c:\Users\siste\OneDrive\Desktop\New folder\WLASL-master\WLASL-master\code\I3D\datasets\nslt_dataset.py", line 59, in load_rgb_frames_from_video
    w, h, c = img.shape
AttributeError: 'NoneType' object has no attribute 'shape'

you got the solution to it?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants