コード例 #1
0
        out_root = sys.argv[8]
    else:
        out_root = data_root

    labeled_file_in = data_root + r'/{}/Labeled/trainingdata.txt'.format(data_tag)
    test_file_in = data_root + r'/{}/Test/test.txt'.format(data_tag) 

    rendered_labeled_out = out_root + r'/{}/Labeled'.format(data_tag)
    rendered_test_out = out_root + r'/{}/Test'.format(data_tag) 

    specular_file = data_root + r'/{}/Labeled/specroughness.txt'.format(data_tag)
    lightpool_file = params_global['envMapFolder'] + r'/lightPool_{}.dat'.format(data_tag)

    AugmentRender = FastRenderEngine(gpuid)
    AugmentRender.SetGeometry('Plane')
    AugmentRender.PreLoadAllLight(r'{}/light.txt'.format(params_global['envMapFolder']))
    AugmentRender.SetSampleCount(128, 1024)
    fovRadian = 60.0 / 180.0 * math.pi
    cameraDist = 1.0  / (math.tan(fovRadian / 2.0))
    AugmentRender.SetCamera(0, 0, cameraDist, 0, 0, 0, 0, 1, 0, fovRadian, 0.01, 100, 384, 384)

    specList_final = {}
    roughnessList_final = {}
    with open(specular_file, 'r') as f:
         rawList = f.read().strip().split('\n')

    for t in rawList:
        mid = int(t.split(',')[0])
        spec = float(t.split(',')[1])
        roughness = float(t.split(',')[2])
        specList_final[mid] = spec
コード例 #2
0
    savedNet = sys.argv[1]
    testParamPath = sys.argv[2]
    gpuid = int(sys.argv[3])

    resultfolder, modelfile = os.path.split(savedNet)
    #Load test params
    test_params = {}
    test_params = loadParams(testParamPath)
    outputFolder = resultfolder + r'/test_{}'.format(test_params['outtag'])
    if (os.path.exists(outputFolder) == False):
        os.makedirs(outputFolder)

    OnlineRender = FastRenderEngine(0)
    OnlineRender.SetGeometry('Sphere')  #params['geometryPath'], True, '')
    OnlineRender.PreLoadAllLight(r'{}/light.txt'.format(
        params['envMapFolder']))

    fovRadian = 60.0 / 180.0 * math.pi
    cameraDist = 1.5 / (math.tan(fovRadian / 2.0))
    OnlineRender.SetCamera(0, 0, cameraDist, 0, 0, 0, 0, 1, 0, fovRadian, 0.01,
                           100, 128, 128)
    OnlineRender.SetSampleCount(128, 512)

    renderContext['experimentTag'] = savedNet

    random.seed(23333)
    np.random.seed(23333)
    caffe.set_random_seed(23333)

    caffe.set_mode_gpu()
    caffe.set_device(gpuid)
コード例 #3
0
    testAlbedo = np.linspace(0.1, 0.95, albedoCnt - 1)
    testSpec = np.linspace(0.1, 0.95, specCnt - 1)
    testRoughness = np.exp(
        np.linspace(math.log(0.03), math.log(0.87), roughnessCnt - 1))

    imageCnt = albedoCnt * specCnt * roughnessCnt * thetaCnt * phiCnt

    envMapFolder = params['envMapFolder']
    with open(envMapFolder + '/light.txt', 'r') as f:
        lightID = map(int, f.read().strip().split('\n'))
        lightID = list(np.array(lightID) - 1)

    np.random.seed(gpuid)
    OnlineRender = FastRenderEngine(gpuid)
    OnlineRender.SetGeometry('Sphere')
    OnlineRender.PreLoadAllLight(r'{}/light.txt'.format(envMapFolder))

    fovRadian = 60.0 / 180.0 * math.pi
    cameraDist = 1.5 / (math.tan(fovRadian / 2.0))
    OnlineRender.SetCamera(0, 0, cameraDist, 0, 0, 0, 0, 1, 0, fovRadian, 0.01,
                           100, 128, 128)
    OnlineRender.SetSampleCount(128, 1024)
    OnlineRender.SetRenderMode(0)

    albedoCnt = len(trainAlbedo)
    specCnt = len(trainSpec)
    roughnessCnt = len(trainRoughness)
    trainCube = np.zeros((albedoCnt, specCnt, roughnessCnt, 3))
    testCube = np.zeros((albedoCnt - 1, specCnt - 1, roughnessCnt - 1, 3))

    print('Rendering Training data...\n')