If curr_frames is a numpy array, what does the last line mean?
curr_frames = np.array(curr_frames)
idx = map(int,np.linspace(0,len(curr_frames)-1,80))
curr_frames = curr_frames[idx,:,:,:,]
解决方案
An important distinction from Python’s built-in lists to numpy arrays:
when slicing in the built-in list it creates a copy.
X=[1,2,3,4,5,6]
Y=X[:3] #[1,2,3]
by slicing X from 0-3 we have created a copy and stored it in the variable Y.
we can verify that by changing the Y and even if we change Y it does not effect X.
Y[0]=20
print(Y) # [20,2,3]
print(X) # [1,2,3,4,5,6]
when slicing in numpy doesn't create a new copy but it still referring to original array
A=np.array([1,2,3,4,5,6])
B=A[:3]
By slicing A here and assigning it to B, still B referring to original array A.
We can verify that by changing an element in B and it will change the value in A as well.
B[0]=20
print(B) # [20,2,3]
print(A) # [20,2,3,4,5,6]