コード例 #1
0
ファイル: verification_pass.py プロジェクト: vd114/galatea
    model = serial.load('/data/lisatmp/goodfeli/darpa_s3c.pkl')
    preprocessor = serial.load(
        '/data/lisatmp/goodfeli/darpa_imagenet_patch_6x6_train_preprocessor.pkl'
    )
    patchifier = ExtractGridPatches(patch_shape=(size, size),
                                    patch_stride=(1, 1))
    preprocessor.items.insert(0, patchifier)

    extractor = FeatureExtractor(model=model, preprocessor=preprocessor)

    xavier = '/data/lisatmp/glorotxa/train'
    thumbnail = '/data/lisatmp/goodfeli/darpa_imagenet'
    feature = '/data/lisatmp/goodfeli/darpa_imagenet_features'

    from galatea.darpa_imagenet.utils import explore_images

    for img_path in explore_images(xavier, '.JPEG'):
        print img_path
        thumbnail_path = img_path.replace(xavier, thumbnail)
        thumbnail_path = thumbnail_path.replace('.JPEG', '.npy')
        if os.path.exists(thumbnail_path):
            feature_path = thumbnail_path.replace(thumbnail, feature)
            if not os.path.exists(feature_path):
                print 'making ' + feature_path
                X = np.load(thumbnail_path)
                X = extractor(X)
                np.save(feature_path, X)
        else:
            print 'No thumbnail!'
            report.write(img_path)
コード例 #2
0
from galatea.darpa_imagenet.utils import explore_images
from pylearn2.utils import serial
from pylearn2.utils import image
import numpy as np
import os
import time

input_path = '/Tmp/glorotxa/train'
output_path = '/Tmp/goodfeli/darpa_imagenet'
image_shape = (32,32)

created_subdirs = set([])

for image_path in explore_images(input_path):

    thumbnail_path = image_path.replace(input_path,output_path)
    thumbnail_path = thumbnail_path.replace('.JPEG','.npy')

    t1 = time.time()
    e =  os.path.exists(thumbnail_path)
    t2 = time.time()
    print t2-t1

    if e:
        continue

    thumbnail_subdir = '/'.join(thumbnail_path.split('/')[:-1])

    if thumbnail_subdir not in created_subdirs:
        serial.mkdir(thumbnail_subdir)
        created_subdirs = created_subdirs.union([thumbnail_subdir])
コード例 #3
0
from galatea.darpa_imagenet.utils import explore_images
from pylearn2.utils import serial
from pylearn2.utils import image
import numpy as np
import os
import time

input_path = '/data/lisatmp/glorotxa/val'
output_path = '/data/lisatmp/goodfeli/darpa_imagenet_valid'
image_shape = (32, 32)

created_subdirs = set([])

for image_path in explore_images(input_path, '.JPEG'):

    thumbnail_path = image_path.replace(input_path, output_path)
    thumbnail_path = thumbnail_path.replace('.JPEG', '.npy')

    t1 = time.time()
    e = os.path.exists(thumbnail_path)
    t2 = time.time()
    print t2 - t1

    if e:
        continue

    thumbnail_subdir = '/'.join(thumbnail_path.split('/')[:-1])

    if thumbnail_subdir not in created_subdirs:
        serial.mkdir(thumbnail_subdir)
        created_subdirs = created_subdirs.union([thumbnail_subdir])
コード例 #4
0
from galatea.darpa_imagenet.utils import explore_images
from pylearn2.utils import serial
from pylearn2.utils import image
import numpy as np
import os
import time

input_path = '/data/lisatmp/glorotxa/train'
output_path = '/data/lisatmp/goodfeli/darpa_imagenet'
image_shape = (32, 32)

created_subdirs = set([])

for image_path in explore_images(input_path):

    thumbnail_path = image_path.replace(input_path, output_path)
    thumbnail_path = thumbnail_path.replace('.JPEG', '.npy')

    t1 = time.time()
    e = os.path.exists(thumbnail_path)
    t2 = time.time()
    print t2 - t1

    if e:
        continue

    thumbnail_subdir = '/'.join(thumbnail_path.split('/')[:-1])

    if thumbnail_subdir not in created_subdirs:
        serial.mkdir(thumbnail_subdir)
        created_subdirs = created_subdirs.union([thumbnail_subdir])
コード例 #5
0

    model = serial.load('/data/lisatmp/goodfeli/darpa_s3c.pkl')
    preprocessor = serial.load('/data/lisatmp/goodfeli/darpa_imagenet_patch_6x6_train_preprocessor.pkl')
    patchifier = ExtractGridPatches( patch_shape = (size,size), patch_stride = (1,1) )
    preprocessor.items.insert(0,patchifier)

    extractor = FeatureExtractor( model = model, preprocessor = preprocessor)

    xavier = '/data/lisatmp/glorotxa/val'
    thumbnail = '/data/lisatmp/goodfeli/darpa_imagenet_valid_thumb'
    feature = '/data/lisatmp/goodfeli/darpa_imagenet_valid_features'

    from galatea.darpa_imagenet.utils import explore_images

    for img_path in explore_images(xavier,'.JPEG'):
        print img_path
        thumbnail_path = img_path.replace(xavier,thumbnail)
        thumbnail_path = thumbnail_path.replace('.JPEG','.npy')
        if os.path.exists(thumbnail_path):
            feature_path = thumbnail_path.replace(thumbnail,feature)
            if not os.path.exists(feature_path):
                print 'making '+feature_path
                X = np.load(thumbnail_path)
                X = extractor(X)
                np.save(feature_path,X)
        else:
            print 'No thumbnail!'
            report.write(img_path)