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

What will be the value of n in:::: train_images = np.zeros((int(len(files)/n), n, 227, 227)) #1

Open
sanjayroka05 opened this issue Dec 4, 2020 · 5 comments

Comments

@sanjayroka05
Copy link

sanjayroka05 commented Dec 4, 2020

Respected Sir thanks for the code. But what will be the value of "n" here ?

  1. Spatio- Temporal Layer Stacked CAE:
    2.1 Training Phase:

files = sorted(glob.glob(UCSD_FOLDER+'/UCSDped1/Train//'))
train_images = np.zeros((int(len(files)/n), n, 227, 227))
i = 0
idx = 0
for filename in range(0, len(files)):
im = Image.open(files[filename])
im = im.resize((n,n))
a[idx,i,:,:] = np.array(im, dtype=np.float32)/255.0
i = i + 1
if i >= n:
idx = idx + 1
i = 0
np.save(UCSD_FOLDER + '/stacked_cae.npy',train_images)

After correctly executing above code I got error:.......................................................................

NameError Traceback (most recent call last)
in ()
1 files = sorted(glob.glob(UCSD_FOLDER+'/UCSDped1/Train//'))
----> 2 train_images = np.zeros((int(len(files)/n), n, 227, 227))
3 i = 0
4 idx = 0
5 for filename in range(0, len(files)):

NameError: name 'n' is not defined

@sanjayroka05 sanjayroka05 changed the title Value of n in train_images = np.zeros((int(len(files)/n), n, 227, 227)) What will be the value of n in:::: train_images = np.zeros((int(len(files)/n), n, 227, 227)) Dec 4, 2020
@AbhishekNanda7429
Copy link

@sanjayroka05 did you get what to put the value of n?

@sanjayroka05
Copy link
Author

sanjayroka05 commented Jan 7, 2021 via email

@AbhishekNanda7429
Copy link

@sanjayroka05 no. i am also trying to find out the value of n

@Rangachary
Copy link

facing the same issue
"NameError: name 'n' is not defined"
Any idea to resolve it?

@Rangachary
Copy link

Dear Sanjay and Abhishek,

Run the below code separately and remove those lines 230-245 from project_code.py

files = sorted(glob.glob(UCSD_FOLDER+'/UCSDped1/Train//'))
n=100
train_images = np.zeros((int(len(files)/n), n, 227, 227))
i = 0
idx = 0
for filename in range(0, len(files)):
im = Image.open(files[filename])
im = im.resize((227,227))
train_images[idx,i,:,:] = np.array(im, dtype=np.float32)/255.0
i = i + 1
if i >= n:
idx = idx + 1
i = 0
np.save(UCSD_FOLDER + '/stacked_cae.npy',train_images)

It works for me. hope may helps to you also.
But Im getting another error:ValueError: convolve2d inputs must both be 2D arrays
In the line 593. (i.e., model_evaluation(model,dataloader,test_dataloader,UCSD_FOLDER,states))

please help me anyone, if you know this.

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

3 participants