當前位置: 首頁>>代碼示例>>Python>>正文


Python DB.storeProject方法代碼示例

本文整理匯總了Python中db.DB.storeProject方法的典型用法代碼示例。如果您正苦於以下問題:Python DB.storeProject方法的具體用法?Python DB.storeProject怎麽用?Python DB.storeProject使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在db.DB的用法示例。


在下文中一共展示了DB.storeProject方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: extract_to

# 需要導入模塊: from db import DB [as 別名]
# 或者: from db.DB import storeProject [as 別名]
    def extract_to(p_h5data, name, p_image, projectId, imageIndex, purpose):
        path = '%s/%s.jpg'%(p_image, imageIndex)
        if os.path.isfile(path):
            return

        project = DB.getProject(projectId)
        project.addImage(imageIndex, annFile=None, segFile=None, score=0.0, purpose=DB.purpose_str_to_int(purpose))
        DB.storeProject( project )
        volume = np.array(h5py.File( p_h5data ,'r')[name],dtype=np.float32)/(2.**8)
        image = volume[int(imageIndex),:,:]
 
        image = color.gray2rgb( image )
        image = imresize(image, (525,525))
        imsave('%s'%(path), image)
開發者ID:Rhoana,項目名稱:icon,代碼行數:16,代碼來源:h5data.py

示例2: save_project

# 需要導入模塊: from db import DB [as 別名]
# 或者: from db.DB import storeProject [as 別名]
    def save_project(self, project):

        p_existing = DB.getProject( project['id'] )
        image_names = DB.getImageNames( project['id'] )

        jsonProject = Project.fromJson( project )

        if p_existing is None:
            print '------'
            print project

            # add the project to the database
            DB.storeProject( jsonProject )

            self.setupModel( project )

            # create the baseline performance metrics
            #Performance.measureBaseline( project['id'] )
        else:
            DB.updateProject( jsonProject )

        # create hidden layers
        #for units in project['hidden_layers']:
        #    DB.storeHiddenUnits(project['id'], project['model_type'], units)
        #DB.storeHiddenUnits(project['id'], project['model_type'], json.loads( project['hidden_layers'] ))
        print 'hidden_layers:'
        print type(project['hidden_layers']), project['hidden_layers']
        DB.storeHiddenUnits(project['id'], project['model_type'], project['hidden_layers'] )

        # copy annotations
        for image in project['images']:
            self.copyAnnotations( image, project )

        # store labels
        for label in project['labels']:
            DB.storeLabel(
            project['id'],
            project['model_type'],
            Label(
            label['index'],
            label['name'],
            label['r'],label['g'],label['b']) )

        self.store_images(project, project['images'], purpose=0)
        self.store_images(project, project['validation_images'], purpose=1)
開發者ID:Rhoana,項目名稱:icon,代碼行數:47,代碼來源:projecthandler.py

示例3: install

# 需要導入模塊: from db import DB [as 別名]
# 或者: from db.DB import storeProject [as 別名]
def install(project):
    # remove any existing model files associated with this project
    path = '%s/best_%s.%s.pkl'%(Paths.Models, project.id, project.type )
    path = path.lower()
    if os.path.exists( path ):
        os.remove( path )

    # remove any existing model files associated with this project
    path = '%s/best_%s.%s.offline.pkl'%(Paths.Models, project.id, project.type )
    path = path.lower()
    if os.path.exists( path ):
        os.remove( path )

    # install the default model
    project.addLabel( 0, 'background', 255,0,0)
    project.addLabel( 1, 'membrane', 0,255,0)

    # setup training set
    paths = glob.glob('%s/*.tif'%(Paths.TrainGrayscale))
    paths.sort()

    # setup the first 20 images as a training set
    i = 0
    for path in paths:
        name = Utility.get_filename_noext( path )
        segFile = '%s/%s.%s.seg'%(Paths.Segmentation, name, project.id)
        annFile = '%s/%s.%s.json'%(Paths.Labels, name, project.id)
        segFile = segFile.lower()
        annFile = annFile.lower()
        if not os.path.exists( segFile ):
            segFile = None
        if not os.path.exists( annFile ):
            annFile = None

        #print 'adding image: %s ann: %s'%(name, annFile)
        project.addImage( imageId=name, annFile=annFile, segFile=segFile)
        i += 1
        if i > 20:
            break

    # store the project
    DB.storeProject( project )
開發者ID:thouis,項目名稱:icon,代碼行數:44,代碼來源:setup.py


注:本文中的db.DB.storeProject方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。