카페 모형의 이동 학습을 해보도록 하겠습니다.
                                            
                                                
                                                
                                                
                                                
                                                
                                                 2365 단어  CaffeTransferLearning
                    
wget https://storage.googleapis.com/openimages/2017_07/images_2017_07.tar.gz
tar -zxvf images_2017_07.tar.gz
wget https://storage.googleapis.com/openimages/2017_07/annotations_machine_2017_07.tar.gz
tar -zxvf annotations_machine_2017_07.tar.gz
 
 import csv
import os
import time
from PIL import Image
import urllib
from PIL import ImageFile
ImageFile.LOAD_TRUNCATED_IMAGES = True
all_tgt = ["cat", "dog", "person", "yard"]
for cur_tgt in all_tgt:
    print '\nClass : ' + str(cur_tgt) + '\n\n'
    f1 = open('/home/ubuntu/labels_'+str(cur_tgt)+'.csv', 'r')
    reader1 = csv.reader(f1)
    f2 = open('/home/ubuntu/2017_07/train/images.csv', 'r')
    reader2 = csv.reader(f2)
    confidence = 1.0
    if cur_tgt == 'yard':
        confidence = 0.9
    cnt = 0
    for row1 in reader1:
        if float(row1[3]) == confidence:
            for row2 in reader2:
                if row1[0] == row2[0]:
                    break
            print str(cnt)+' : '+row2[2]
            #load image
            try:
                urlimg = urllib.urlopen(row2[2])            
                img = Image.open(urlimg)
            except:
                continue # skip if error happened
            fname = '/home/ubuntu/downloaded_images/'+str(cur_tgt)+'.'+str(cnt)+'.jpg'
            if urlimg.url.find('unavailable') == -1:
                if cur_tgt != 'yard':
                    #resize image
                    ratio = img.width / 227.0
                    if img.height < img.width:
                        ratio = img.height / 227.0
                    img_resize = img.resize((int(round(img.width/ratio)), int(round(img.height/ratio))))
                    img_resize.save(fname)
                else:
                    img.save(fname)
                cnt = cnt + 1
                if 10000 <= cnt:
                    break
    f1.close()
    f2.close()
Reference
이 문제에 관하여(카페 모형의 이동 학습을 해보도록 하겠습니다.), 우리는 이곳에서 더 많은 자료를 발견하고 링크를 클릭하여 보았다 https://qiita.com/kinoppy/items/0edab44ea14f617dd2b3텍스트를 자유롭게 공유하거나 복사할 수 있습니다.하지만 이 문서의 URL은 참조 URL로 남겨 두십시오.
                                
                                
                                
                                
                                
                                우수한 개발자 콘텐츠 발견에 전념
                                (Collection and Share based on the CC Protocol.)