Giter Club home page Giter Club logo

Comments (10)

sacmehta avatar sacmehta commented on August 23, 2024

You should not include the image reading and writing time, because those operations are slow. As a standard convention, none of the models report inference time with image reading and writing operations.

from espnetv2.

nithishc829 avatar nithishc829 commented on August 23, 2024

No sir I am not including them

ROI of code
start_time = time.time()
# run the mdoel
output1 = model(input)
time_taken = time.time() - start_time
time_list.append(time_taken)

Function used for inference time

def val(args, val_loader, model, criterion):
'''
:param args: general arguments
:param val_loader: loaded for validation dataset
:param model: model
:param criterion: loss function
:return: average epoch loss, overall pixel-wise accuracy, per class accuracy, per class iu, and mIOU
'''
#switch to evaluation mode
model.eval()

iouEvalVal = iouEval(args.classes)

epoch_loss = []
time_list = []
total_batches = len(val_loader)
blist = helpers.get_label_info_new(args.csvfile)
for i, (input, target) in enumerate(val_loader):
    
    if args.onGPU :
        print('Non_blocking')
        input = input.cuda(non_blocking=True) #torch.autograd.Variable(input, volatile=True)
        target = target.cuda(non_blocking=True)#torch.autograd.Variable(target, volatile=True)
    else:
        print('Blocking')
        input = input.cuda() #torch.autograd.Variable(input, volatile=True)
        target = target.cuda()#torch.autograd.Variable(target, volatile=True)

    start_time = time.time()
    # run the mdoel
    output1 = model(input)
    time_taken = time.time() - start_time
    time_list.append(time_taken)
    # compute the loss
    loss = criterion(output1, target)
    epoch_loss.append(loss.item())
    # compute the confusion matrix
    iouEvalVal.addBatch(output1.max(1)[1].data, target.data)
    print('[%d/%d] loss: %.3f time: %.4f' % (i, total_batches, loss.item(), time_taken))

average_epoch_loss_val = sum(epoch_loss) / len(epoch_loss)
overall_acc, per_class_acc, per_class_iu, mIOU = iouEvalVal.getMetric()
print('Average fps ',1/np.mean(np.array(time_list)))
return average_epoch_loss_val, overall_acc, per_class_acc, per_class_iu, mIOU

from espnetv2.

sacmehta avatar sacmehta commented on August 23, 2024

Do not include the first iteration because PyTorch has some initialization time

from espnetv2.

nithishc829 avatar nithishc829 commented on August 23, 2024

Yes you are right sir. I saw that too. I removed the first 5 samples for profiling and still the average is 53 fps.

from espnetv2.

sacmehta avatar sacmehta commented on August 23, 2024

What version of cudnn and cuda are you using?

from espnetv2.

nithishc829 avatar nithishc829 commented on August 23, 2024

CUDA
nvcc: NVIDIA (R) Cuda compiler driver
Copyright (c) 2005-2018 NVIDIA Corporation
Built on Sat_Aug_25_21:08:01_CDT_2018
Cuda compilation tools, release 10.0, V10.0.130

CUDNN version 7
libcudnn.so.7

from espnetv2.

sacmehta avatar sacmehta commented on August 23, 2024

Use below code to check cuDNN version. All versions does not have cuDNN optimized depth-wise convolutions.

import torch
print(torch.backends.cudnn.version())

from espnetv2.

nithishc829 avatar nithishc829 commented on August 23, 2024

import torch
print(torch.backends.cudnn.version())
7402

from espnetv2.

sacmehta avatar sacmehta commented on August 23, 2024

I assume you are using PyTorch 0.4+. COuld you try making following changes to your code and see what happens:

device=torch.device('cuda')
with torch.no_grad():
      for i, (input, _) in enumerate(val_loader):
            input = input.to(device=device)
            start_time = time.time()
            # run the mdoel
            output1 = model(input)
            time_taken = time.time() - start_time
            time_list.append(time_taken)

I also noticed that your GPU is different than the one we used. TitanX is considerably faster than GTX 1080, so that explains the difference in speed.

from espnetv2.

nithishc829 avatar nithishc829 commented on August 23, 2024

I did the changes you mentioned, however the fps is same. I understand that TitanX is faster. I thought some issue in implementation detail is causing this performance issue. But this is too much difference in fps i.e I got almost 3x less speed, I was not expecting this...

Anyhow, thanks for quick response and support. You can close this issue sir.
Really good paper sir.

How can I contact you ? for more information ?

from espnetv2.

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.