Code Monkey home page Code Monkey logo

perception's Introduction

perception

A Wordpress Plugin which classifies Media Library images by detecting individual objects and faces within images using Google Cloud Vision API.

Installation

This repository is the source code and won't work on your website, if you are looking for the plugin itself you can download the latest version from here.

Features

Detects broad sets of categories within an image, which range from modes of transportation to animals, popular product logos, popular natural and man-made structures, topical entities like celebrities, or news events.

Working Demo

Requirements

Local Development

Docker is all you need for local development. With the docker daemon running, build and run the application using:

make start

the above command will build the image for both Wordpress and MySQL and run the containers and install Composer dependencies inside src folder.

Your Wordpress instance will be available on http://localhost:8000

To see the full list of available commands run make help

Important Notes

Please note that Google Cloud Vision API is a commercial service and while it's free for first 1000 units/month but you will be charged for any request after that. See their pricing here.

To better understand their pricing table, here is the list of the features we use in this plugin:

  • Label Detection
  • Landmark Detection
  • Logo Detection
  • Web Detection

Set up your project

  1. In the Cloud Platform Console, go to the Manage resources page and select or create a new project. Link
  2. Enable billing for your project. Link
  3. Enable the Cloud Vision API. Link

Authentication

For using this plugin, You need to provide a JSON file which contains your Project ID and Key. By following the steps below you can obtain them.

  1. In Cloud Platform Console, navigate to the Create service account key page.
  2. From the Service account dropdown, select New service account.
  3. Input a name into the Service account name form field.
  4. From the Role dropdown, select Project > Owner.
  5. Click the Create button. A JSON file that contains your key downloads to your computer.

Keep the JSON file on your computer, you will need it during the plugin installation.

Contributing

Contributions are welcome. Create a pull request to get started.

Issues

Please report any issues here.

perception's People

Contributors

amirandalibi 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

Watchers

 avatar  avatar  avatar  avatar

perception's Issues

Fatal Error during activation

Thanks for sharing your code!

Since I activated the Plugin, I receive an HTTP-error while uploading.
screenshot 2017-12-20 11 06 32
My API console didn´t log any incoming requests, so I think it gets stuck before.
If I deactivate the plugin I can upload the files again.

Do you have an Idea why that happens?

Another Question: Where do you store the Tags? In the Description?

Activation issue / HTTP error on media upload / feature suggestion

Hi Amir!
We're giving your plugin a shot on a client site, where they want to be able to add searchable (front and back end) labels to each image (there are 1000s) in an automated fashion. We installed your plugin and noted a few issues. We'd love to work with you to improve this if you're available and willing!

Issues:

  • Upon activation there is an error due to a missing /vendor directory (so couldn't load /vendor/autoload.php). I "fixed" this in our version by commenting out line 17 of perception.php. I don't know if that really fixed anything, but given that directory didn't exist in the plugin download it at least allowed the plugin to activate.

  • After that, the plugin could activate and the setup steps were simple to follow. Except, we had to add a line to wp-config.php temporarily so that we could upload a json file through the WP media uploader. This explanation could be added to the readme, or, if a straight URL is accepted you could just direct the developer to upload the json file to root and provide the URL.

  • Once we went through setup, which apparently is ok, I thought that maybe existing images would be labeled. But I then realized they have to go through the upload process to be labeled with the meta tag. It may be a nice feature addition to allow a "regenerate Google labels" or something like that, so that if a user puts this on AFTER their media library is full, the labels will get generated for older images.

  • I did try uploading some images but got a generic HTTP error message in the media uploader. Disabling the plugin lets me upload images again, but uploading them with perception activated does not work currently. I didn't look too far into this.

Hopefully that helps! We'd love to be a part of making this plugin a great tool for our client and others, so let us know how we can help. Thanks!
Heather

Can not activate the plugin

Warning: require(vendor/autoload.php): failed to open stream: No such file or directory in /var/www/xxx.com/public_html/wp-content/plugins/perception-master/perception.php on line 17

Fatal error: require(): Failed opening required 'vendor/autoload.php' (include_path='.:/usr/share/php') in /var/www/xxx.com/public_html/wp-content/plugins/perception-master/perception.php on line 17

Uploading error on large images

Here is how it happens:

  1. I activate the plugin
  2. I upload a photo
  3. I get an HTTP error

I can see the requests coming to the Google Cloud (see below)

image.

  1. The uploading process of the media file remains stuck
    image

image

I don't have the PHP log at the moment.

How to display image metadata?

Hey!

Thanks for the plugin btw!

So there is no value in the description/title whatever metadata field for a given image, but its in the database under wp_postmeta.

How do i 'echo' the value for a specific id? Is it necessary to use a mysql command or is there a build in wordpress function for it?

thanks!

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.