Coder Social home page Coder Social logo

Validation images in batches. about lightcnn HOT 3 CLOSED

AYG-DL avatar AYG-DL commented on May 18, 2024
Validation images in batches.

from lightcnn.

Comments (3)

AlfredXiangWu avatar AlfredXiangWu commented on May 18, 2024

I have no idea about it. Could you show me your modified code?

from lightcnn.

AYG-DL avatar AYG-DL commented on May 18, 2024

def main(image,batchSize):
timer0 = time.time()
model = LightCNN_9Layers(num_classes=79077)
model.eval()
model = torch.nn.DataParallel(model).cuda()
checkpoint = torch.load("/scratch/user/ayu2224/CV/De-Occlude/dcgan_code_files/LightCNN/LightCNN_9Layers_checkpoint.pth.tar")
model.load_state_dict(checkpoint['state_dict'])
timer1 = time.time()
transform = transforms.Compose([transforms.ToTensor()])
count = 0
input = torch.zeros(batchSize, 1, 128, 128)
#image = image[:,0,:,:]
input = input.cuda()
image.resize_as_(input)
input = image
#print("")
#print(type(input))
#print("
")
input_var = torch.autograd.Variable(input, volatile=True)
_, features = model(input_var)
timer2 = time.time()
print ("Checkpoint: ", timer1 -timer0)
print ("Model: ", timer2-timer1)
#print("coming here")
#print(type(features))
#print(features.data.size())
#print(type(features.data))
return features.data.cuda()

//here is the snippet of the code that I am using. The batchsize that I used was 64. I load the pretrained model provided by you.

from lightcnn.

AYG-DL avatar AYG-DL commented on May 18, 2024

I really would like advice on this as I have a deadline to meet.

from lightcnn.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.