Giter VIP home page Giter VIP logo

ai's Introduction

Recent Releases

  • v1.30支持腾讯云人脸识别(2018-12-7)
  • v1.20支持百度图片搜索(2018-8-13)
  • v1.10支持百度人体分析(2018-8-7)

Recent Test

  • 所有API在2018-01-11通过测试

Develop documents

开发文档

Feature

  • 统一AI平台SDK调用方法;
  • 像查询数据库一样优雅调用API;
  • 所传参数和原平台开发文档保持一致,节约开发者学习成本

Support platform(支持的平台)

1.百度AI开放平台

2.腾讯优图AI开放平台

3.FACE++AI开放平台

4.腾讯云人脸识别

SimpleTest

  1. 下载zip包 或者clone本项目

  2. 进入本项目根目录,执行composer install,(包管理工具composer

  3. 在项目目录tests->config下面添加配置文件ai.php(需要自己到各平台注册获取试用账号),内容如:

    return [
        'debug' => true,
        'log' => [
            'level' => 'debug',
            'file' => './tests/logs/ai.log',//日志相对路径
            'template' => "<<<<<<<<\n{response}\n--------\n{error}",//日志模版
        ],
        'baidu' => [
            'app_id' => '***',
            'app_key' => '***',
            'secret_key' => '***',
        ],
        'youtu' => [
             'app_id' => '***',
             'secret_id' => '***',
             'secret_key' => '***',
             'user_id' => '*'
        ],
        'face_plus' => [
             'api_key' => '***',
             'api_secret' => '***',
        ],
        'qcloud' => [//腾讯云
    	'app_id' => '***',
    	'secret_id' => '***',
    	'secret_key' => '***',
        ]
    ];
  4. 在命令行下进入根目录,执行命令,比如测试腾讯优图人脸识别: vendor/phpunit/phpunit/phpunit --testdox tests/Youtu/Face/FaceTest.php

Installation

composer require hahaxixi/ai

Usage

1.一般使用

$config = [
    'log' => [...],//如,laravel:'file' => storage_path('logs/ai.log'),
    'baidu' => [...],
    'youtu' => [...],
    'face_plus' => [...],
];

//百度
$result = Entry::Baidu($config)->face->select('detect')->where(['image' => file_get_contents(__DIR__ . '/file/face_detect.jpeg'), 'id_card_side' => 'front'])->get();
//腾讯优图
$result = Entry::Youtu($config)->face->select('detectface')->where(['url' => 'http://open.youtu.qq.com/app/img/experience/face_img/face_06.jpg', 'mode' => 1])->get();
//face++
$result = Entry::FacePlus($config)->face->select('detect')->where(['image_file' =>__DIR__ . '/../../file/face_01.jpg' , 'return_attributes' => 'skinstatus'])->get();
//腾讯云
$result = Entry::Qcloud($config)->face->select('identify')->where(['image' => __DIR__ . '/../../file/face_01.jpg', 'appid' => $config['qcloud']['app_id'], 'group_ids' => ["tencent"]])->get();

2.Laravel使用

  • 项目目录config下面添加配置文件ai.php,配置内容和上文SimpleTest一致
  • 一行代码调用人脸检测示例
$result = Entry::Baidu(config('ai'))->face->select('detect')->where(['image' => file_get_contents(__DIR__ . '/file/face_detect.jpeg'), 'id_card_side' => 'front'])->get();

3.Yii2使用

  • 在配置文件params-local.php添加
    'ai'=>[
        'log' => [...],
        'face_plus' => [...],
        'baidu' => [...],
        'youtu' => [...],
    ],
  • 一行代码调用人脸检测示例
$result = Entry::Baidu(Yii::$app->params['ai'])->face->select('detect')->where(['image' => file_get_contents(__DIR__ . '/file/face_detect.jpeg'), 'id_card_side' => 'front'])->get();

License

Apache License Version 2.0 see Apache License

ai's People

Contributors

crisenchou avatar huanghe avatar lljiuzheyang avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

ai's Issues

请教关于 symfony/cache冲突的问题

E:\wamp64\www\rageframe2>E:\wamp64\bin\php\php7.2.14\php.exe composer.phar requi
re hahaxixi/ai
Using version ^1.30 for hahaxixi/ai
./composer.json has been updated
Loading composer repositories with package information
Updating dependencies (including require-dev)
Your requirements could not be resolved to an installable set of packages.

Problem 1
- Conclusion: don't install hahaxixi/ai v1.30
- Conclusion: remove symfony/cache v4.2.4
- Conclusion: don't install symfony/cache v4.2.4
- Installation request for hahaxixi/ai ^1.30 -> satisfiable by hahaxixi/ai[v
1.30].
- Conclusion: don't install symfony/cache v4.2.4
- hahaxixi/ai v1.30 requires symfony/cache ^3.3 -> satisfiable by symfony/ca
che[v3.3.0, v3.3.1, v3.3.10, v3.3.11, v3.3.12, v3.3.13, v3.3.14, v3.3.15, v3.3.1
6, v3.3.17, v3.3.18, v3.3.2, v3.3.3, v3.3.4, v3.3.5, v3.3.6, v3.3.7, v3.3.8, v3.
3.9, v3.4.0, v3.4.1, v3.4.10, v3.4.11, v3.4.12, v3.4.13, v3.4.14, v3.4.15, v3.4.
16, v3.4.17, v3.4.18, v3.4.19, v3.4.2, v3.4.20, v3.4.21, v3.4.22, v3.4.23, v3.4.
24, v3.4.25, v3.4.26, v3.4.27, v3.4.28, v3.4.3, v3.4.4, v3.4.5, v3.4.6, v3.4.7,
v3.4.8, v3.4.9].
- Can only install one of: symfony/cache[v3.3.0, v4.2.4].
- Can only install one of: symfony/cache[v3.3.1, v4.2.4].
- Can only install one of: symfony/cache[v3.3.10, v4.2.4].
- Can only install one of: symfony/cache[v3.3.11, v4.2.4].
- Can only install one of: symfony/cache[v3.3.12, v4.2.4].
…………………………
- Can only install one of: symfony/cache[v3.4.5, v4.2.4].
- Can only install one of: symfony/cache[v3.4.6, v4.2.4].
- Can only install one of: symfony/cache[v3.4.7, v4.2.4].
- Can only install one of: symfony/cache[v3.4.8, v4.2.4].
- Can only install one of: symfony/cache[v3.4.9, v4.2.4].
- Installation request for symfony/cache (locked at v4.2.4) -> satisfiable b
y symfony/cache[v4.2.4].

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.