Не работает, потому что np.delete не работает inplace
.Возвращает копию с удаленными значениями.См. Официальную документацию .
Поэтому замена
np.delete(images, images[i], axis=0)
на
images = np.delete(images, images[i], axis=0)
должна работать.
Вы можетепросто используйте родной Python del
вот так:
In[50]: images = np.empty((500,400,400,3))
In[51]: del images
In[52]: images
Traceback (most recent call last):
File "<ipython-input-53-49a4f536d6a7>", line 1, in <module>
images
NameError: name 'images' is not defined