Пример #1
0
def facepp_detect():
    API_KEY = '76f2ed8ab272e8793c990ae6c9e0a5e8'
    API_SECRET = 'RdVvpVpLaBYi37eMfGzAa8drJyDtDBpE'
    api = API(API_KEY, API_SECRET)
    count = 0
    for pic in POSITIVE_SAMPLES:
        #if pic != "../data/positive_samples/IMG_7207.JPG":
        #    continue
        st = time.time()
        res =  api.detection.detect(img = File(pic), mode = 'normal')
        print pic,":",(time.time()-st)*1000,"ms"
        if has_valid_pic(res):
            count += 1
            print pic,":YES"
        else:
            print pic,":NO",":",len(res['face'])

    print "True Positive:",round(float(count)*100/len(POSITIVE_SAMPLES),2)
    print "False Negative:",100 - round(float(count)*100/len(POSITIVE_SAMPLES),2)

    count = 0
    for pic in NEGTIVE_SAMPLES:
        #if pic != "../data/negtive_samples/IMG_7404.JPG":
        #    continue
        res =  api.detection.detect(img = File(pic),  mode='normal')
        if not has_valid_pic(res):
            count += 1
            print pic,":YES"
        else:
            print pic,":NO",":",len(res['face'])

    print "True Negative:",round(float(count)*100/len(NEGTIVE_SAMPLES),2)
    print "False Positive:",100 - round(float(count)*100/len(NEGTIVE_SAMPLES),2)
Пример #2
0
    def is_person(self, image_file):
        path = 'media/image/face.png'
        # path = os.path.join('media/image/', image_file.filename)
        image_file.save(path)

        # import ipdb; ipdb.set_trace()
        f = File(path)
        api = API(API_KEY, API_SECRET, SERVER)

        print("Sending face to api")

        response = api.recognition.identify(group_name='Hackathoners', img=f)

        print(response)

        faces = response['face']
        if len(faces) > 0:
            face = faces[0]
            name = face['candidate'][0]['person_name']

            if name in self.people.keys():
                print("Found " + name)
                self.audio.add_to_playlist(self.people[name])
                self.audio.play()
            else:
                self.audio.add_to_playlist('run.wav')
                self.audio.play()
                print("Did not match a person.")
Пример #3
0
 def __init__(self,
              id='test',
              API_KEY='w1s9SPlbJkhetEnq-BD8puseCT2LDTyj',
              API_SECRET='a8uEA_hK6lzuRHAY-LiqhlNcoDmS3I7A'):
     self.api = API(API_KEY, API_SECRET)
     self.Face = {}
     self.id = id
     self.search_result = {}
def processing():
    api = API(API_KEY, API_SECRET)
    #url = "http://blogs.reuters.com/great-debate/files/2013/07/obama-best.jpg"
    result = api.detection.detect(img=File(
        'C:/Users/Bhawana/Desktop/bhaw.jpg'))  #to detect   local images

    #result = api.detection.detect(url=url)  to detect online images
    return print_result(result)
Пример #5
0
def test_facepp(pic):
    #pic = '../data/negtive_samples/IMG_7404.JPG'
    #pic = '../data/positive_samples/IMG_7116.JPG'
    API_KEY = '76f2ed8ab272e8793c990ae6c9e0a5e8'
    API_SECRET = 'RdVvpVpLaBYi37eMfGzAa8drJyDtDBpE'
    api = API(API_KEY, API_SECRET)
    res = api.detection.detect(img = File(pic), mode='normal')
    print_result('detect result', res)
Пример #6
0
def analysisPhoto(imgPath):
	face1,face2,results,smile = 0, 0, 0, 0
        api = API(APIKEY, APISCRETE)
        try:
    	    detect_res = api.detection.detect(img=File(imgPath))
        except Exception,e:
            print e
            detect_res = {}
Пример #7
0
def getset():
    API_KEY = "-PJkamhZzEUkUgv_wvopwTgVSWBVhblr"
    API_SECRET = "1heuneo4ixxDAAAKmHrc_dGIP1NMhxne"
    api_server_international = 'https://api-cn.faceplusplus.com/facepp/v3/faceset/getfacesets'
    api = API(API_KEY, API_SECRET)
    data = {"api_key":API_KEY, "api_secret":API_SECRET}
    response = requests.post(api_server_international, data = data)
    req_con = response.content.decode('utf-8')
    req_dict = JSONDecoder().decode(req_con)
    print(req_dict['facesets'])
Пример #8
0
 def __init__(self, dbpath=SHELVE_DB):
     self.api = API(API_KEY, API_SECRET)
     if RASPBERRYPI:
         GPIO.setmode(GPIO.BCM)
         GPIO.setup(BCM_PIN4_SHOW_TAKE_PHOTO, GPIO.OUT)
         GPIO.output(BCM_PIN4_SHOW_TAKE_PHOTO, True)
     try:
         self.api.faceset.create(outer_id = 'default')
     except APIError as e:
         """如果 'default' 已创建, 忽略改错误。"""
         pass
     self.camera_lock = threading.Lock()
Пример #9
0
def detect(path):
    API_KEY = "3o6_lMDRxcpYalXhuXq9cymJeeN7cHCS"
    API_SECRET = "6776wZFWYVfYjwDgS8G_0rmWhtXVyUcW"
    from facepp import API, File
    api = API(API_KEY, API_SECRET)
    result = api.detect(image_file=File(path),return_landmark=1)
    landmarks = result['faces'][0]['landmark']
    new_dict = {}
    for k,v in landmarks.iteritems():
        
        new_dict[k] = np.array([v['y'],v['x']])
    return new_dict
def facedetect(path):
    API_KEY = "RuF7pDgXRAl0EfZjZrWIYElt_QoO-XhN"
    API_SECRET = "lpUhYiPv8dSdFgMyjkaBKvO2X1nbKzv1"
    from facepp import API, File
    api = API(API_KEY, API_SECRET)
    result = api.detect(image_file=File(path), return_landmark=1)
    #we only detect face feature points
    landmarks = result['faces'][0]['landmark']
    feature_dict = {}
    for k, v in landmarks.iteritems():
        feature_dict[k] = np.array([v['x'], v['y']])
    return feature_dict
Пример #11
0
    def __init__(self, path):
        self.path = path
        self.api = API(API_KEY, API_SECRET, srv=api_server_international)
        self.frame_count = 0
        self.per_frame = 1
        self.folder_list = []
        self.video_list = {}

        self.open_folder()

        with open("log.txt", "w") as log:
            print "reset log"
Пример #12
0
def Oauth(key_file='', verifier_file='flickr.verifier'):
    API_KEY = '0b9ca8fca8041e791d684c0b88fe5708'
    API_SECRET = '4WlmUalSo3_SLScJyBaaJvgMCWjK3-WR'

    flickr_key = '31573003eefcabb832334323de5027a0'
    flickr_secret = 'f66472f76f1992ee'

    flickr_api.set_keys(api_key=flickr_key, api_secret=flickr_secret)

    a = flickr_api.auth.AuthHandler.load(verifier_file)
    flickr_api.set_auth_handler(a)
    face_api = API(API_KEY, API_SECRET)
    return face_api
Пример #13
0
def createFace ():

    # 您需要先注册一个App,并将得到的API key和API secret写在这里。
    # You need to register your App first, and enter you API key/secret.
    API_KEY = "o_aUYdJlo0Pl1beu0kXiIQShUheA7pe3"
    API_SECRET = "Q0DrLrFybJvD7VP_XCKbOEeVeq7mUdLA"

    #get the folder list
    name_list=os.listdir('/Users/Roy/Documents/masterthesis/image_set')
    print (name_list)
    face_list=[]
    for i in range(len(name_list)):
        face_url = '/Users/Roy/Documents/masterthesis/image_set/'+name_list[i]
        face_list.append(face_url)
    print face_list

    api_server_international = 'https://api-us.faceplusplus.com/facepp/v3/'
    # First import the API class from the SDK
    # 首先,导入SDK中的API类
    from facepp import API, File

    #创建一个API对象,如果你是国际版用户,代码为:api = API(API_KEY, API_SECRET, srv=api_server_international)
    #Create a API object, if you are an international user,code: api = API(API_KEY, API_SECRET, srv=api_server_international)
    api = API(API_KEY, API_SECRET)

    api.faceset.delete(outer_id='test1', check_empty=0)
    print('deleted')

    # 创建一个Faceset用来存储FaceToken
    # create a Faceset to save FaceToken
    ret = api.faceset.create(outer_id='test1')
    # print_result("faceset create", ret)
    print('faceset create')

    # 对图片进行检测
    # detect image
    Face = {}
    Face2 = {}
    for i in range(len(face_list)):
        res = api.detect(image_file=File(face_list[i]))
        # Face['person'+str(i)] = res["faces"][0]["face_token"]
        Face[name_list[i]] = res["faces"][0]["face_token"]
    print (Face)
    # print (Face2)

    # 将得到的FaceToken存进Faceset里面
    # save FaceToken in Faceset
    my_faceset = api.faceset.addface(outer_id='test1', face_tokens=Face.itervalues())
    print('finally create')
   
    return Face
Пример #14
0
def bidui(image_path):
	import sys
	reload(sys)
	sys.setdefaultencoding( "utf-8" )
	#将需要识别的图片和集合对比

	#------------------------------------------------------------------------------
	#准备阶段
	API_KEY = "a4OWmRJTir1XGFx6vZtwPvlf6nsYxErQ"
	API_SECRET = "Q1bR1pHjv7SGWa3xSN0tNivJ4lK0K8Tu"
	#国际版的服务器地址
	api_server_international = 'https://api-us.faceplusplus.com/facepp/v3/'
	# 导入系统库并定义辅助函数
	from pprint import pformat
	def print_result(hit, result):
		def encode(obj):
			if type(obj) is unicode:
				return obj.encode('utf-8')
			if type(obj) is dict:
				return {encode(v): encode(k) for (v, k) in obj.iteritems()}
			if type(obj) is list:
				return [encode(i) for i in obj]
			return obj
		print hit
		result = encode(result)
		print '\n'.join("  " + i for i in pformat(result, width=75).split('\n'))
	#导入SDK中的API类
	from facepp import API, File
	#创建一个API对象
	api = API(API_KEY, API_SECRET)

	#-----------------------------------------------------------------------------
	# 本地图片的地址
	face_search = image_path
	# 对待比对的图片进行检测
	Face = {}
	res = api.detect(image_file=File(face_search))
	#print_result("face_search", res)
	#搜索相似脸
	search_result = api.search(face_token=res["faces"][0]["face_token"], outer_id='finally')
	# 输出结果
	search_confidence = search_result['results'][0]['confidence']
	uers=search_result['results'][0]['user_id']
	print '置信度:', search_confidence
	if search_confidence >=80:
		print '你好!',uers.decode('utf-8')
		return 1
	else:
		return 0
def detect(path):
    API_KEY = "3o6_lMDRxcpYalXhuXq9cymJeeN7cHCS"
    API_SECRET = "6776wZFWYVfYjwDgS8G_0rmWhtXVyUcW"
    from facepp import API, File
    api = API(API_KEY, API_SECRET)
    result = api.detect(image_file=File(path),return_landmark=1)
    landmarks = result['faces'][0]['landmark']
    #print(landmarks)
    keys = [ 'left_eye_right_corner','left_eye_left_corner','right_eye_right_corner','right_eye_left_corner','left_eyebrow_right_corner','right_eyebrow_left_corner',
              'mouth_right_corner','mouth_left_corner','mouth_lower_lip_left_contour2','mouth_lower_lip_left_contour3','mouth_lower_lip_bottom','mouth_lower_lip_right_contour2','mouth_lower_lip_right_contour3','nose_left','nose_right']
    new_dict = {}
    for k,v in landmarks.iteritems():
        
        new_dict[k] = np.array([v['x'],v['y']])

    return new_dict
Пример #16
0
def analyze_user(filepath, id_img):
    print filepath
    api = API(API_KEY, API_SECRET)
    ret = api.faceset.create(outer_id=id_img)
    # print_result("faceset create", ret)

    Face = {}
    res = api.detect(image_file=File(filepath))
    if res["faces"]:
        Face['person'] = res["faces"][0]["face_token"]
        res = api.face.analyze(
            image_file=File(filepath),
            face_tokens=Face['person'],
            return_attributes=
            'gender,age,smiling,glass,headpose,facequality,blur')
        print_result("person", res)

    # res = api.detect(image_file=File(face_two))
    # print_result("person_two", res)
    # Face['person_two'] = res["faces"][0]["face_token"]

    # # 将得到的FaceToken存进Faceset里面
    # # save FaceToken in Faceset
    # api.faceset.addface(outer_id=id_test, face_tokens=Face.itervalues())

    # # 对待比对的图片进行检测,再搜索相似脸
    # # detect image and search same face
    # ret = api.detect(image_file=File(face_search))
    # print_result("detect", ret)
    # search_result = api.search(face_token=ret["faces"][0]["face_token"], outer_id=id_test)

    # # 输出结果
    # # print result
    # print_result('search', search_result)
    # print '=' * 60
    # for k, v in Face.iteritems():
    #     if v == search_result['results'][0]['face_token']:
    #         print 'The person with highest confidence:', k
    #         break

    api.faceset.delete(outer_id=id_img, check_empty=0)
    return res
def processing(name):
    api = API(API_KEY, API_SECRET)
    #url = "http://blogs.reuters.com/great-debate/files/2013/07/obama-best.jpg"

    #result = api.detection.detect(img = File(os.path.join('uploads/',str(name)))) #to detect   local images
    #result = api.detection.detect(url=url)  to detect online images
    #return attributeExtractionToCsv(result)

    print "going to take video"
    vidcap = cv2.VideoCapture(os.path.join("video", name))
    print "video captured"
    count = 0

    while count < 10:
        print "image taking"
        success, image = vidcap.read()
        print 'Read a new frame: ', success
        cv2.imwrite(os.path.join("Frames", "frame%d.jpg" % count),
                    image)  # save frame as JPEG file
        count += 1
        print "image taken"
        vidcap.set(cv2.CAP_PROP_POS_MSEC, count * 600)

    fields = [
        'File Name', 'Face Id', 'Distance b/w left eye and nose',
        'Distance b/w right eye and nose',
        'Distance b/w nose and left side of mouth',
        'Distance b/w nose and right side of mouth'
    ]
    initializeTestCSV(fields)
    count = 0
    for filename in os.listdir('Frames'):
        if filename.endswith(".jpg") or filename.endswith(
                ".png") or filename.endswith(".jpeg"):
            result = api.detection.detect(img=File(
                os.path.join('Frames', filename)))  #to detect   local images
            count = count + 1
            attributeExtractionToCsv(result, fields, filename)
            print "frame " + str(count)
        else:
            continue
    return perplexedFinalResult()
Пример #18
0
def batch_process(src_path,dst_path):
    api = API(API_KEY,API_SECRET);
    cnt = 0;
    for parent,dirnames,filenames in os.walk(src_path):
        filenames.sort();
        while (not len(filenames)==0):
            filename = filenames.pop();
            if (os.path.exists(os.path.join(dst_path,os.path.splitext(filename)[0]+'.npy'))):
                cnt = cnt+1;
                continue;
            try:
                result = api.detect(image_file = File(os.path.join(parent,filename)),return_landmark=2,
                                    return_attributes="gender,age,headpose,eyestatus,emotion,mouthstatus,eyegaze")
                np.save(os.path.join(dst_path,os.path.splitext(filename)[0]+'.npy'),result);
                cnt = cnt+1;
                print(cnt,filename)
#                dictionary = np.load(filename).item()
            except APIError, error:
                print(error.body);
                filenames.append(filename);
Пример #19
0
    def __init__(self,
                 path_to_analyze_config,
                 output_dir_name="analyzed_result",
                 wait_time=None):
        self.path_to_analyze_config = path_to_analyze_config
        with open(self.path_to_analyze_config, "r") as f:
            self.config = yaml.load(f, Loader=yaml.SafeLoader)
        self.output_dir_name = output_dir_name

        self.wait_time = wait_time  #自然数で指定する必要がある.

        if self.config["output_json_name"] is None:
            self.output_json_name = "output"
        else:
            self.output_json_name = self.config["output_json_name"]

        self.api = API(API_KEY=self.config["API_KEY"],
                       API_SECRET=self.config["API_SECRET"])

        del self.config["API_KEY"], self.config["API_SECRET"]
Пример #20
0
def get_faceplusplus_keypoints(imagepath):
    # face++ API access
    api = API(apicfg.API_KEY, apicfg.API_SECRET, apicfg.SERVER)

    img = cv2.imread(imagepath)
    kpts_list = []

    try:
        faces = api.detection.detect(img=File(imagepath))

        for face in faces['face']:
            result = api.detection.landmark(face_id=face['face_id'])
            keypoints = result['result'][0]['landmark']
            for kpt in keypoints:
                x = img.shape[1] * keypoints[kpt]['x']/100
                y = img.shape[0] * keypoints[kpt]['y']/100
                keypoints[kpt] = (x, y)
            kpts_list.append(keypoints)

    except Exception, e:
        print e
Пример #21
0
def init():
    import sys
    import os.path
    if sys.version_info.major != 2:
        sys.exit('Python 2 is required to run this program')

    fdir = None
    if hasattr(sys, "frozen") and \
            sys.frozen in ("windows_exe", "console_exe"):
        fdir = os.path.dirname(os.path.abspath(sys.executable))
        sys.path.append(fdir)
        fdir = os.path.join(fdir, '..')
    else:
        fdir = os.path.dirname(__file__)

    with open(os.path.join(fdir, 'apikey.cfg')) as f:
        exec(f.read())

    srv = locals().get('SERVER')
    from facepp import API
    return API(API_KEY, API_SECRET, srv=srv)
Пример #22
0
def action():
    api = API(API_KEY, API_SECRET)
    cap = cv2.VideoCapture(0)

    while True:
        ret, frame = cap.read()
        cv2.imwrite('demo.jpeg', frame, [int(cv2.IMWRITE_JPEG_QUALITY), 40])

        # detect image
        Face = {}
        res = api.detect(image_file=File(face_one),
                         return_landmark=2,
                         return_attributes='headpose',
                         calculate_all=1)
        try:
            #print_result("person_one", res['time_used'])
            #print_result("person_one", res['faces'][0]['attributes']['headpose'])
            head = res['faces'][0]['attributes']['headpose']
            for i in range(3):
                if head[headposelist[i]] < (-1) * int(detectrange[i]):
                    print action[i][0]
                if head[headposelist[i]] > detectrange[i]:
                    print action[i][1]
        except:
            continue
        for item in res['faces'][0]['landmark']:
            try:
                y = res['faces'][0]['landmark'][item]['x']
                x = res['faces'][0]['landmark'][item]['y']
                frame[x, y] = [0, 0, 255]
                frame[x + 1, y] = [0, 0, 255]
                frame[x, y + 1] = [0, 0, 255]
                frame[x - 1, y] = [0, 0, 255]
                frame[x, y - 1] = [0, 0, 255]
            except:
                continue
        cv2.imshow("capture", frame)
        cv2.waitKey(1)
Пример #23
0
def face(img):
	from pprint import pformat
	from facepp import API 
	faceppAPI_KEY = 'db212fa5bc488db66c97808b2c9ef665'
	faceppAPI_SECRET = 'lcv2MD_fMt2FeCyWrG91mZvDxutlu3OM'
	api = API(faceppAPI_KEY, faceppAPI_SECRET)	

	rst = api.detection.detect(url = img)
	gend = {'Male': 0, 'Female': 1}
	peopletile = [["花样少年", "风华正茂", "当立男儿", "不惑壮士"],["豆蔻年华","风姿卓越","风韵犹存","徐娘半老"]]
	def age_stage(age):
		if age <16:
			res = 0
		elif age <30:
			res = 1
		elif age <40:
			res = 2
		else:
			res = 3
		return res
	peopleindex = 1
	reply  = ''
	print  len(rst['face'])
	if len(rst['face']) > 1:
		reply = '别着急,让我喝口水一个一个说\n'
   	for face in rst['face']: 	
		if len(rst['face']) > 1:
			reply += '第'+str(peopleindex)+'位,'
		peopleindex += 1
		gender = face['attribute']['gender']['value']
		age = face['attribute']['age']['value']
		reply +=  '我看您'+ peopletile[gend[gender]][age_stage(age)]+', 心理年龄是'+str(age) +'岁'
		reply += '\n'
	#print_result("Name",rst)
	
	return reply
Пример #24
0
img_re = './photo1.jpg'
img2_re = './photo.jpg'


# 此方法专用来打印api返回的信息
def print_result(hit, result):
    print(hit)
    print('\n'.join("  " + i for i in pformat(result, width=75).split('\n')))


def printFuctionTitle(title):
    return "\n" + "-" * 60 + title + "-" * 60


# 初始化对象,进行api的调用工作
api = API()
# -----------------------------------------------------------人脸识别部分-------------------------------------------

# 人脸检测:https://console.faceplusplus.com.cn/documents/4888373
while True:
    command = "fswebcam -d /dev/video0 -r 600*600 /home/wyx/桌面/one_re/photo1.jpg"  #启动照相机 拍照
    os.system(command)
    time.sleep(2)
    face_cascade = cv2.CascadeClassifier(
        "/opt/ros/kinetic/share/OpenCV-3.3.1-dev/haarcascades/haarcascade_frontalface_alt2.xml"
    )  #导入opencv的参数
    img = cv2.imread("/home/wyx/桌面/one_re/photo1.jpg")  #读取照片信息
    gray = cv2.cvtColor(img, cv2.COLOR_BGR2GRAY)  #得到灰度图像
    faces = face_cascade.detectMultiScale(gray)  #使用opencv自带库寻找照片中是否有人脸
    if (len(faces) > 0):  #返回值大于0 存在人脸
        face_re = True
Пример #25
0
import os
import sys
import cv2
import numpy as np
import contour
from facepp import API, File, APIError

API_KEY = 'bf7eae5ed9cf280218450523049d5f94'
API_SECRET = 'o6SeKJTnaoczTb-j6PBEGXvkiVz2hp71'
api = API(API_KEY, API_SECRET)

feature_list = [
	'left_eyebrow_left_corner',
	'right_eyebrow_right_corner',
	'contour_chin',
]
def get_feature_points(face, w, h):
	landmark = api.detection.landmark(face_id=face['face_id'], type='83p')
	result = []
	for v in feature_list:
		x = landmark['result'][0]['landmark'][v]['x'] * w / 100
		y = landmark['result'][0]['landmark'][v]['y'] * h / 100
		result.append([x,y])
	return result

if __name__ == '__main__':
    if len(sys.argv) <= 1:
        print "usage: %s <image src> <image dst>" % sys.argv[0]
        exit(1)
    # we assume that these a images are in the same pose bin
Пример #26
0
    consumer_secret = auth.getconsumer_secret()
    access_token = auth.getaccess_token()
    access_token_secret = auth.getaccess_token_secret()

    auth = tweepy.OAuthHandler(consumer_key, consumer_secret)
    auth.secure = True
    auth.set_access_token(access_token, access_token_secret)

    #Connect Google Maps API
    gmaps = googlemaps.Client(key='AIzaSyCGwI22mO3khzq1_cttVxoBTK_auzfWEjI')

    #Connect Face++ API
    SERVER = 'http://api.us.faceplusplus.com/'
    API_KEY = '3a7092b400dc9827359d7093801f057d'
    API_SECRET = 'ChXgzhIEau8A1O_aKOanTS7dzY0AgVKQ'
    facepp_api = API(API_KEY, API_SECRET, SERVER)

    #Connect CouchDB
    print 'Connecting CouchDB...'
    data_base = connect_couchdb('http://115.146.89.191:5984/',
                                'melbourne_tweets_new')

    #Prepare for ML Models
    lemmatizer = nltk.stem.wordnet.WordNetLemmatizer()
    wordSet = set(nltk.corpus.words.words())
    stopwords = set(nltk.corpus.stopwords.words('english'))
    hashtagwords_temp = []
    text_training_set = "training_text_final.txt"
    description_training_set = "training_description_final.txt"
    prob_training_set = "training_prob_final.txt"
    test_set = "test.txt"
Пример #27
0
def get_facepp_api():
    from facepp import API
    from djv.utils import get_api_secrets

    return API(get_api_secrets()['facepp']['deja vu']['key'],
               get_api_secrets()['facepp']['deja vu']['secret'])
Пример #28
0
def InsertFaceTable(site, iline_list):
    sql_command_insertface = "INSERT INTO FaceTable_{0} VALUES({1})".format(site, iline_list)
    cur.execute(sql_command_insertface)
    connection.commit()


# import csv
from facepp import API
import os

# csv数据name photoId userid photoTakeTime photoUploadTime photoTitle photoDescription photoGeotag longitude latitude accuracy url
API_KEY = "oSzQJ7Owxqk2T5yZuIHKoJ3s_n11BDQP"
API_SECRET = "6wv-sD-NgKWm0kRK757UxUDsbuzj0TYs"
api_server_international = 'https://api-us.faceplusplus.com/facepp/v3/'
api = API(API_KEY, API_SECRET, srv=api_server_international)

path = "C:\\Users\\HCHO\\Desktop\\data"
flickrDataFileUrl = []
flickrDataName = []
# 将os.walk在元素中提取的值,分别放到root(根目录),dirs(目录名),files(文件名)中。
# 将csv文件路径储存倒flickrDataFile数组中
for root, dirs, files in os.walk(path):
    for file in files:
        if ".csv" in file:
            flickrDataFileUrl.append(os.path.join(root, file))
            flickrDataName.append(file.replace('.csv', ''))
for j in range(0, 2):
    CreateDetectTable(flickrDataName[j])
    CreateFaceTable(flickrDataName[j])
Пример #29
0
def deleteset(outer_id):
    API_KEY = "-PJkamhZzEUkUgv_wvopwTgVSWBVhblr"
    API_SECRET = "1heuneo4ixxDAAAKmHrc_dGIP1NMhxne"
    api_server_international = 'https://api-us.faceplusplus.com/facepp/v3/'
    api = API(API_KEY, API_SECRET)
    api.faceset.delete(outer_id=outer_id, check_empty=0)
Пример #30
0
import time
import urllib2
from urllib2 import URLError
from socket import socket




import sys, os, glob, time
from boto.s3.connection import S3Connection
from boto.s3.key import Key
from pprint import pformat
from facepp import API
from subprocess import call

api = API("API_KEY", "API_SECRET")

GPIO.setwarnings(False)

GPIO.setmode(GPIO.BCM)
GPIO.setup(7, GPIO.OUT)

GPIO.setup(4, GPIO.IN, GPIO.PUD_DOWN)
previous_state = False
current_state = False

conn = S3Connection("AWS_ACCESS","AWS_SECRET")
bucket = conn.get_bucket('imagesfrompi')
directory = '/home/pi/'

TARGET_IMAGE = 'https://imagesfrompi.s3.amazonaws.com/image2.jpg'