utils.writeErrToFile('renderErrs', renderErrs, testingLog, epoch, j) utils.writeErrToFile('renderGtErrs', renderGtErrs, testingLog, epoch, j) directErrsNpList = np.concatenate( [directErrsNpList, utils.turnErrorIntoNumpy(directErrs) ], axis=0) globalIllu2ErrsNpList = np.concatenate( [globalIllu2ErrsNpList, utils.turnErrorIntoNumpy(globalIllu2Errs)], axis=0) globalIllu3ErrsNpList = np.concatenate( [globalIllu3ErrsNpList, utils.turnErrorIntoNumpy(globalIllu3Errs)], axis=0) renderErrsNpList = np.concatenate( [renderErrsNpList, utils.turnErrorIntoNumpy(renderErrs)], axis=0 ) renderGtErrsNpList = np.concatenate( [renderGtErrsNpList, utils.turnErrorIntoNumpy(renderGtErrs)], axis=0 ) utils.writeNpErrToScreen('globalIllu2_Accu:', np.mean(globalIllu2ErrsNpList[1:j+1, :], axis=0), epoch, j) utils.writeNpErrToScreen('globalIllu3_Accu:', np.mean(globalIllu3ErrsNpList[1:j+1, :], axis=0), epoch, j) utils.writeNpErrToScreen('directErrs_Accu:', np.mean(directErrsNpList[1:j+1, :], axis=0), epoch, j) utils.writeNpErrToScreen('renderErrs_Accu:', np.mean(renderErrsNpList[1:j+1, :], axis=0), epoch, j) utils.writeNpErrToScreen('renderGtErrs_Accu:', np.mean(renderGtErrsNpList[1:j+1, :], axis=0), epoch, j) utils.writeNpErrToFile('globalIllu2_Accu:', np.mean(globalIllu2ErrsNpList[1:j+1, :], axis=0), testingLog, epoch, j) utils.writeNpErrToFile('globalIllu3_Accu:', np.mean(globalIllu3ErrsNpList[1:j+1, :], axis=0), testingLog, epoch, j) utils.writeNpErrToFile('directErrs_Accu:', np.mean(directErrsNpList[1:j+1, :], axis=0), testingLog, epoch, j) utils.writeNpErrToFile('renderErrs_Accu:', np.mean(renderErrsNpList[1:j+1, :], axis=0), testingLog, epoch, j) utils.writeNpErrToFile('renderGtErrs_Accu:', np.mean(renderGtErrsNpList[1:j+1, :], axis=0), testingLog, epoch, j) if j == 1 or j % 2000 == 0: # Save the ground truth and the input vutils.save_image( (0.5*(albedoBatch + 1)*segBatch.expand_as(albedoBatch) ).data, '{0}/{1}_albedoGt.png'.format(opt.experiment, j) ) vutils.save_image( (0.5*(normalBatch + 1)*segBatch.expand_as(normalBatch) ).data, '{0}/{1}_normalGt.png'.format(opt.experiment, j) ) vutils.save_image( (0.5*(roughBatch + 1)*segBatch.expand_as(roughBatch) ).data, '{0}/{1}_roughGt.png'.format(opt.experiment, j) ) depthOut = 1 / torch.clamp(depthBatch, 1e-6, 10) * segBatch.expand_as(depthBatch)
if j < 1000: utils.writeNpErrToScreen( 'pointAccu', np.mean(pointErrsNpList[1:j + 1, :], axis=0), epoch, j) utils.writeNpErrToScreen( 'normalAccu', np.mean(normalErrsNpList[1:j + 1, :], axis=0), epoch, j) utils.writeNpErrToScreen( 'meanAngleAccu', np.mean(meanAngleErrsNpList[1:j + 1, :], axis=0), epoch, j) utils.writeNpErrToScreen( 'medianAngleAccu', np.mean(medianAngleErrsNpList[1:j + 1, :], axis=0), epoch, j) utils.writeNpErrToFile( 'pointAccu', np.mean(pointErrsNpList[1:j + 1, :], axis=0), trainingLog, epoch, j) utils.writeNpErrToFile( 'normalAccu', np.mean(normalErrsNpList[1:j + 1, :], axis=0), trainingLog, epoch, j) utils.writeNpErrToFile( 'meanAngleAccu', np.mean(meanAngleErrsNpList[1:j + 1, :], axis=0), trainingLog, epoch, j) utils.writeNpErrToFile( 'medianAngleAccu', np.mean(medianAngleErrsNpList[1:j + 1, :], axis=0), trainingLog, epoch, j) else: utils.writeNpErrToScreen( 'pointAccu', np.mean(pointErrsNpList[j - 999:j + 1, :],
'albedoAccu', np.mean(albedoErrsNpList[1:j + 1, :], axis=0), epoch, j) utils.writeNpErrToScreen( 'normalAccu', np.mean(normalErrsNpList[1:j + 1, :], axis=0), epoch, j) utils.writeNpErrToScreen( 'roughAccu', np.mean(roughErrsNpList[1:j + 1, :], axis=0), epoch, j) utils.writeNpErrToScreen( 'depthAccu', np.mean(depthErrsNpList[1:j + 1, :], axis=0), epoch, j) utils.writeNpErrToScreen( 'globalIllu1Accu', np.mean(globalIllu1ErrsNpList[1:j + 1, :], axis=0), epoch, j) utils.writeNpErrToFile( 'albedoAccu', np.mean(albedoErrsNpList[1:j + 1, :], axis=0), trainingLog, epoch, j) utils.writeNpErrToFile( 'normalAccu', np.mean(normalErrsNpList[1:j + 1, :], axis=0), trainingLog, epoch, j) utils.writeNpErrToFile( 'roughAccu', np.mean(roughErrsNpList[1:j + 1, :], axis=0), trainingLog, epoch, j) utils.writeNpErrToFile( 'depthAccu', np.mean(depthErrsNpList[1:j + 1, :], axis=0), trainingLog, epoch, j) utils.writeNpErrToFile( 'globalIllu1Accu', np.mean(globalIllu1ErrsNpList[1:j + 1, :], axis=0), trainingLog, epoch, j) else:
utils.writeNpErrToScreen( 'globalIllu2Accu', np.mean(globalIllu2ErrsNpList[1:j + 1, :], axis=0), epoch, j) utils.writeNpErrToScreen( 'globalIllu3Accu', np.mean(globalIllu3ErrsNpList[1:j + 1, :], axis=0), epoch, j) utils.writeNpErrToScreen('imgEnvAccu', np.mean(imgEnvErrsNpList[1:j + 1, :], axis=0), epoch, j) utils.writeNpErrToScreen('envAccu:', np.mean(envErrsNpList[1:j + 1, :], axis=0), epoch, j) utils.writeNpErrToFile('albedoAccu', np.mean(albedoErrsNpList[1:j + 1, :], axis=0), testingLog, epoch, j) utils.writeNpErrToFile('normalAccu', np.mean(normalErrsNpList[1:j + 1, :], axis=0), testingLog, epoch, j) utils.writeNpErrToFile('roughAccu', np.mean(roughErrsNpList[1:j + 1, :], axis=0), testingLog, epoch, j) utils.writeNpErrToFile('depthAccu', np.mean(depthErrsNpList[1:j + 1, :], axis=0), testingLog, epoch, j) utils.writeNpErrToFile('globalIllu1Accu', np.mean(globalIllu1ErrsNpList[1:j + 1, :], axis=0), testingLog, epoch, j) utils.writeNpErrToFile('globalIllu2Accu',
utils.writeNpErrToScreen('albedoAccu', np.mean(albedoErrsNpList[1:j + 1, :], axis=0), epoch, j) utils.writeNpErrToScreen('normalAccu', np.mean(normalErrsNpList[1:j + 1, :], axis=0), epoch, j) utils.writeNpErrToScreen('roughAccu', np.mean(roughErrsNpList[1:j + 1, :], axis=0), epoch, j) utils.writeNpErrToScreen('depthAccu', np.mean(depthErrsNpList[1:j + 1, :], axis=0), epoch, j) utils.writeNpErrToFile('albedoAccu', np.mean(albedoErrsNpList[1:j + 1, :], axis=0), testingLog, epoch, j) utils.writeNpErrToFile('normalAccu', np.mean(normalErrsNpList[1:j + 1, :], axis=0), testingLog, epoch, j) utils.writeNpErrToFile('roughAccu', np.mean(roughErrsNpList[1:j + 1, :], axis=0), testingLog, epoch, j) utils.writeNpErrToFile('depthAccu', np.mean(depthErrsNpList[1:j + 1, :], axis=0), testingLog, epoch, j) if j == 1 or j % 200 == 0: # Save the ground truth and the input vutils.save_image(((albedoBatch)**(1.0 / 2.2)).data, '{0}/{1}_albedoGt.png'.format(opt.testRoot, j))
utils.turnErrorIntoNumpy(globalIllu2Errs)], axis=0) globalIllu3ErrsNpList = np.concatenate( [globalIllu3ErrsNpList, utils.turnErrorIntoNumpy(globalIllu3Errs)], axis=0) if j < 1000: utils.writeNpErrToScreen( 'globalIllu2_Accu:', np.mean(globalIllu2ErrsNpList[1:j + 1, :], axis=0), epoch, j) utils.writeNpErrToScreen( 'globalIllu3_Accu', np.mean(globalIllu3ErrsNpList[1:j + 1, :], axis=0), epoch, j) utils.writeNpErrToFile( 'globalIllu2_Accu', np.mean(globalIllu2ErrsNpList[1:j + 1, :], axis=0), trainingLog, epoch, j) utils.writeNpErrToFile( 'globalIllu3_Accu', np.mean(globalIllu3ErrsNpList[1:j + 1, :], axis=0), trainingLog, epoch, j) else: utils.writeNpErrToScreen( 'globalIllu2_Accu', np.mean(globalIllu2ErrsNpList[j - 999:j + 1, :], axis=0), epoch, j) utils.writeNpErrToScreen( 'globalIllu3_Accu', np.mean(globalIllu3ErrsNpList[j - 999:j + 1, :], axis=0), epoch, j) utils.writeNpErrToFile(
utils.writeErrToFile('normal', [normalErr], trainingLog, epoch, j) utils.writeErrToFile('rough', [roughErr], trainingLog, epoch, j) utils.writeErrToFile('depth', [depthErr], trainingLog, epoch, j) albedoErrsNpList = np.concatenate( [albedoErrsNpList, utils.turnErrorIntoNumpy( [albedoErr] )], axis=0) normalErrsNpList = np.concatenate( [normalErrsNpList, utils.turnErrorIntoNumpy( [normalErr] )], axis=0) roughErrsNpList = np.concatenate( [roughErrsNpList, utils.turnErrorIntoNumpy( [roughErr] )], axis=0) depthErrsNpList = np.concatenate( [depthErrsNpList, utils.turnErrorIntoNumpy( [depthErr] )], axis=0) if j < 1000: utils.writeNpErrToScreen('albedoAccu', np.mean(albedoErrsNpList[1:j+1, :], axis=0), epoch, j ) utils.writeNpErrToScreen('normalAccu', np.mean(normalErrsNpList[1:j+1, :], axis=0), epoch, j ) utils.writeNpErrToScreen('roughAccu', np.mean(roughErrsNpList[1:j+1, :], axis=0), epoch, j ) utils.writeNpErrToScreen('depthAccu', np.mean(depthErrsNpList[1:j+1, :], axis=0), epoch, j ) utils.writeNpErrToFile('albedoAccu', np.mean(albedoErrsNpList[1:j+1, :], axis=0), trainingLog, epoch, j) utils.writeNpErrToFile('normalAccu', np.mean(normalErrsNpList[1:j+1, :], axis=0), trainingLog, epoch, j) utils.writeNpErrToFile('roughAccu', np.mean(roughErrsNpList[1:j+1, :], axis=0), trainingLog, epoch, j) utils.writeNpErrToFile('depthAccu', np.mean(depthErrsNpList[1:j+1, :], axis=0), trainingLog, epoch, j) else: utils.writeNpErrToScreen('albedoAccu', np.mean(albedoErrsNpList[j-999:j+1, :], axis=0), epoch, j) utils.writeNpErrToScreen('normalAccu', np.mean(normalErrsNpList[j-999:j+1, :], axis=0), epoch, j) utils.writeNpErrToScreen('roughAccu', np.mean(roughErrsNpList[j-999:j+1, :], axis=0), epoch, j) utils.writeNpErrToScreen('depthAccu', np.mean(depthErrsNpList[j-999:j+1, :], axis=0), epoch, j) utils.writeNpErrToFile('albedoAccu', np.mean(albedoErrsNpList[j-999:j+1, :], axis=0), trainingLog, epoch, j) utils.writeNpErrToFile('normalAccu', np.mean(normalErrsNpList[j-999:j+1, :], axis=0), trainingLog, epoch, j) utils.writeNpErrToFile('roughAccu', np.mean(roughErrsNpList[j-999:j+1, :], axis=0), trainingLog, epoch, j) utils.writeNpErrToFile('depthAccu', np.mean(depthErrsNpList[j-999:j+1, :], axis=0), trainingLog, epoch, j)
epoch, j) utils.writeNpErrToScreen('normal2Accu', np.mean(normal2ErrsNpList[1:j + 1, :], axis=0), epoch, j) utils.writeNpErrToScreen( 'medianAngle2Accu', np.mean(medianAngle2ErrsNpList[1:j + 1, :], axis=0), epoch, j) utils.writeNpErrToScreen('meanAngle2Accu', np.mean(meanAngle2ErrsNpList[1:j + 1, :], axis=0), epoch, j) utils.writeNpErrToScreen('renderedAccu', np.mean(renderedErrsNpList[1:j + 1, :], axis=0), epoch, j) utils.writeNpErrToFile('normal1Accu', np.mean(normal1ErrsNpList[1:j + 1, :], axis=0), trainingLog, epoch, j) utils.writeNpErrToFile('medianAngle1Accu', np.mean(medianAngle1ErrsNpList[1:j + 1, :], axis=0), trainingLog, epoch, j) utils.writeNpErrToFile('meanAngle1Accu', np.mean(meanAngle1ErrsNpList[1:j + 1, :], axis=0), trainingLog, epoch, j) utils.writeNpErrToFile('normal2Accu', np.mean(normal2ErrsNpList[1:j + 1, :], axis=0), trainingLog, epoch, j) utils.writeNpErrToFile('medianAngle2Accu', np.mean(medianAngle2ErrsNpList[1:j + 1, :], axis=0), trainingLog, epoch, j) utils.writeNpErrToFile('meanAngle2Accu', np.mean(meanAngle2ErrsNpList[1:j + 1, :], axis=0),
utils.writeErrToFile('normal', [normalErr], trainingLog, epoch, j) utils.writeErrToFile('rough', [roughErr], trainingLog, epoch, j) utils.writeErrToFile('depth', [depthErr], trainingLog, epoch, j) albedoErrsNpList = np.concatenate( [albedoErrsNpList, utils.turnErrorIntoNumpy( [albedoErr] )], axis=0) normalErrsNpList = np.concatenate( [normalErrsNpList, utils.turnErrorIntoNumpy( [normalErr] )], axis=0) roughErrsNpList = np.concatenate( [roughErrsNpList, utils.turnErrorIntoNumpy( [roughErr] )], axis=0) depthErrsNpList = np.concatenate( [depthErrsNpList, utils.turnErrorIntoNumpy( [depthErr] )], axis=0) if j < 1000: utils.writeNpErrToScreen('albedoAccu', np.mean(albedoErrsNpList[1:j+1, :], axis=0), epoch, j ) utils.writeNpErrToScreen('normalAccu', np.mean(normalErrsNpList[1:j+1, :], axis=0), epoch, j ) utils.writeNpErrToScreen('roughAccu', np.mean(roughErrsNpList[1:j+1, :], axis=0), epoch, j ) utils.writeNpErrToScreen('depthAccu', np.mean(depthErrsNpList[1:j+1, :], axis=0), epoch, j ) utils.writeNpErrToFile('albedoAccu', np.mean(albedoErrsNpList[1:j+1, :], axis=0), trainingLog, epoch, j) utils.writeNpErrToFile('normalAccu', np.mean(normalErrsNpList[1:j+1, :], axis=0), trainingLog, epoch, j) utils.writeNpErrToFile('roughAccu', np.mean(roughErrsNpList[1:j+1, :], axis=0), trainingLog, epoch, j) utils.writeNpErrToFile('depthAccu', np.mean(depthErrsNpList[1:j+1, :], axis=0), trainingLog, epoch, j) else: utils.writeNpErrToScreen('albedoAccu', np.mean(albedoErrsNpList[j-999:j+1, :], axis=0), epoch, j) utils.writeNpErrToScreen('normalAccu', np.mean(normalErrsNpList[j-999:j+1, :], axis=0), epoch, j) utils.writeNpErrToScreen('roughAccu', np.mean(roughErrsNpList[j-999:j+1, :], axis=0), epoch, j) utils.writeNpErrToScreen('depthAccu', np.mean(depthErrsNpList[j-999:j+1, :], axis=0), epoch, j) utils.writeNpErrToFile('albedoAccu', np.mean(albedoErrsNpList[j-999:j+1, :], axis=0), trainingLog, epoch, j) utils.writeNpErrToFile('normalAccu', np.mean(normalErrsNpList[j-999:j+1, :], axis=0), trainingLog, epoch, j) utils.writeNpErrToFile('roughAccu', np.mean(roughErrsNpList[j-999:j+1, :], axis=0), trainingLog, epoch, j) utils.writeNpErrToFile('depthAccu', np.mean(depthErrsNpList[j-999:j+1, :], axis=0), trainingLog, epoch, j) if j == 1 or j% 2000 == 0: