Пример #1
0
def  svm_glassy_hog_entry(gpath):
    
    elmlist = gcom_glassylist(gpath)
    for elm in elmlist:
       if svm_hog_is_svm_aviable(gpath,elm) ==False:
            continue
       svm_hog_elm_train(gpath,elm)
Пример #2
0
def smfex_create_hog_filelist(gpath):

    a = gcom_glassylist(gpath)

    for elm in a:
        gcom_svm_filelist(gpath, elm)
        print elm, '.....'
Пример #3
0
def ttext_redis_load(r, ttpath):
    glassylist = gcom_glassylist(ttpath)

    for i in range(1, 5):
        r.delete('%s_%d' % (set_ttext_pfix, i))

    for text in glassylist:
        textlen = len(text)
        if textlen > 4:
            continue
        text_set = '%s_%d' % (set_ttext_pfix, textlen)
        r.sadd(text_set, text)
        subpath = '%s%s\\' % (ttpath, text)
        ttext_addto_redis(subpath, text, r)

        textfilelist = gcom_getfilelist(subpath)

        htablename = 'h_%s_title' % (text)
        #先删除
        r.delete(htablename)

        print htablename

        for txfile in textfilelist:
            ttext_title_addto_redis(subpath, txfile, r, htablename)
Пример #4
0
def tup_png_elms(r, srcpath, dstpath):

    elmlist = gcom_glassylist(srcpath)

    for elm in elmlist:
        print elm
        tup_png_elm(r, srcpath, elm, dstpath)
Пример #5
0
def smfex_test_glassy_Entry(gpath, fextype):

    elmlist = gcom_glassylist(gpath)
    for elm in elmlist:
        if smfex_is_avisiable(gpath, elm, fextype, 1) == False:
            continue
        smfex_svm_elm(gpath, elm, fextype)
        break
Пример #6
0
def smfex_train_glassy_Entry(gpath):

    elmlist = gcom_glassylist(gpath)
    for elm in elmlist:
        for fextype in g_svm_fex_list:
            if smfex_is_avisiable(gpath, elm, fextype, 1) == False:
                continue
            smfex_elm_train_find_opt(gpath, elm, fextype)
Пример #7
0
def hog_svm_create_filelist(gpath):
    
    a = gcom_glassylist(gpath);
    
    for elm in a:
        gcom_svm_filelist(gpath,elm)
        
        print elm ,'filish ....'
Пример #8
0
def hog_svm_create_hog(gpath):
    
    a = gcom_glassylist(gpath);
    
    for elm in a:
        if svm_hog_is_svm_aviable(gpath,elm) ==False:
            continue
        hog_create_hog_elm(gpath,elm)
        print elm ,'filish ....'
Пример #9
0
def tool_match_text(patha,pathb):
    aelmlist = gcom_glassylist(patha)
    
    belmlist = gcom_glassylist(pathb)
    
    
    for  a in aelmlist:
        if  a in belmlist :
          num = gcom_getfilelist(os.path.join(pathb,a))
          print a, len(num) 
        else :
          print '           .....  ',a
          cpath = os.path.join('E:\\picdog\\glassy',a)
          if os.path.isdir(cpath) ==False:
              continue
          cfilelist = gcom_getfilelist(cpath)
          for cfl  in cfilelist:
              baidu_rg_singleimage(cpath,cfl)
Пример #10
0
def fex_redis_load(r, gpath):

    glassylist = gcom_glassylist(gpath)
    fex_update_glassylist(glassylist, r)

    for elm in glassylist:
        for key in statfexture:
            fexstat_addto_redis('%s%s\\' % (gpath, elm), elm, r, key,
                                statfexture[key])
        for key in basefexture:
            fexbase_addto_redis('%s%s\\' % (gpath, elm), elm, r, key,
                                basefexture[key])
Пример #11
0
def smfex_create_vector(gpath, fextype):

    a = gcom_glassylist(gpath)

    for elm in a:
        if smfex_is_avisiable(gpath, elm, fextype, 0) == False:
            continue
        print elm, fextype, '.....'
        if cmp(fextype, svm_fex_hog) == 0:
            smfex_create_elm_hog(gpath, elm)

        else:

            gcom_svm_fexture_vector(gpath, elm, fextype)
Пример #12
0
def rgim_search_inAllElm(r, fname, simage_fexture, tagflag, excuelms):
    pointst = time.clock()

    glassylist = gcom_glassylist(gl_glassy_entry_path)

    negaflag = np.zeros(8, 'int8')
    minphash = 64 + np.zeros(8, 'int')
    mphashelm = [''] * 8

    for elm in glassylist:
        bconflag = 0
        for telm in excuelms:
            if cmp(elm, telm) == 0:
                bconflag = 1
                break
        if bconflag == 1:
            continue

        elmfexture = fex_read_elm(r, elm)

        for i in range(8):
            if tagflag[i] == 1 and negaflag[i] == 0:
                key = '%d' % (i + 1)
                opt = rgim_Afile_Cut_in_elm(
                    simage_fexture[key], elm,
                    elmfexture)  # 调用精简版的api 函数只 计算phash

                if minphash[i] > opt[fex_phash][vector_opt]:
                    minphash[i] = opt[fex_phash][vector_opt]
                    mphashelm[i] = elm
                if rgim_phash_makesure(opt[fex_phash][vector_opt]):  #### 重要参数
                    negaflag[i] = 1  #   该图像可以被排除,其它类别中有该图片的更合适的匹配
                    gcom_log_pscode_rg(
                        fname, elm, key + ' should be more like *************')
                    break

    pointgap = time.clock() - pointst
    print 'time gap .....', pointgap
    gcom_log_pscode_rg(
        fname, '', mphashelm[0] + mphashelm[1] + mphashelm[2] + mphashelm[3] +
        mphashelm[4] + mphashelm[5] + mphashelm[6] + mphashelm[7])

    return [negaflag, minphash]