2
$\begingroup$

I am planning to make an image classifier that identifies the face of every player in the English Premier League. I have a couple of questions (since until now I have only worked with small or academic datasets).

My questions:

  1. How do I download this many different images? Since it's pretty hard to manually download the pictures individually, is there a way to automate it?
  2. I'm following this platform and am required to make a different class for each player. How should I go about making different classes for so many players?

PS: I am a newbie, so I apologize if my questions are vague. Please comment if any additional clarification is needed.

$\endgroup$
1
$\begingroup$

How do I download these many different images? Since it's pretty hard to manually download the pictures of all, is there a way to automate it?

First of all, you need to get an idea of how your classifier will be, will it classify variable size images or fixed size images? Will it receive only one face as an input or more than one? Will it classify black and white images or with more than one channel? Will it be a multioutput classifier or a single output classifier?

Before starting you have to answer this and other questions. Based on the later questions you have to get your data from a different source or in a different way. Instead of thinking these questions you can search for a dataset that already has the images collected and organized and adapt to the dataset, Kaggle has lots of public datasets. Collecting the training data by your own can be tedious work, and more if you need thousands of samples, I recommend you to make a data mining application the crawls through different pages and automatically downloads the images, although you have to be careful not to violate any privacy laws.

I am using Fast.ai and we are required to make a different class for each player. How should I go about making different classes for so many players?

Now that you have all the data clean and tidy you have to classify the images. There are lots of ways to classify images using deep neural networks, you could use simple feedforward neural networks or recurrent neural networks, but the most commonly used and the one I recommend you are convolutional neural networks. If you do not have a lot of experience classifying images I recommend you to start with an easier project such as the MNIST dataset, which consists of black an white images of handwritten digits, this way you can practice with the different hyperparameters and experiment better, rather than starting with such an ambitious classification task. Either way, to classify the images into multiple outputs you will have to add a final layer to your neural network with a number of hidden neurons equal to the number of classes to distinguish, then you should add a softmax activation function to that layer. Finally, for the model to learn you should use a categorial cross entropy loss/cost function.

I don't know if I answered your question or not at all so please don't hesitate into telling me or asking more questions.

Either way, glad to help

| improve this answer | |
$\endgroup$
1
$\begingroup$

One way face recognition is done is with one-shot learning and siamese networks. You only gather one example of the face you want to recognize. You then train two CNNs with shared parameters that are able to encode one image each. Then you feed both these encodings to something that can measure the similarity between them and compare that to the ground truth (were the pictures of the same person or not).

Picture from Andrew Ng's deep learning course where you get to implement face recognition: Siamese network

So you train the network by sometimes giving it two pictures of the same person and sometimes giving it pictures of different people.

When the siamese network is trained it can be used to build a encoding database of all you players and when you get a new picture you search through this database until you find the one giving you the best similarity score.

There are many ways to implement this with different levels of difficulty and performance. It is a non-standard problem so it will be a bit harder than regular image classification. I will leave you with some references:

Ready to use solution:

pip face_recoginition package

Papers:

Learning Similarity Metric Discriminatively with Application to Face Verification

DeepFace: Closing the Gap to Human-Level Performance in Face Verification

Tutorials:

One Shot Learning with Siamese Networks in PyTorch - Part 1

One Shot Learning with Siamese Networks in PyTorch - Part 2

One Shot Learning with Siamese Networks using Keras

Introduction to Web Scraping with BeautifulSoup

Courses

Andrew Ng's course on CNNs, here is a sample video about siamese networks

| improve this answer | |
$\endgroup$
  • $\begingroup$ Thank you @simon Larsson I just competed for the 3rd course of Andrew Ng's specialization. Can you suggest any ways to scrape the web for images of so many players? $\endgroup$ – Shawn May 11 '19 at 9:22
  • $\begingroup$ Find a site that have the images in a structured way and then use something like beautifulsoup to scrape images and names from the website. But that is not really data science and is better asked over at stackoverflow.com. I added a tutorial on it in my answer. $\endgroup$ – Simon Larsson May 11 '19 at 10:11
  • $\begingroup$ Thak you Simon. I will keep in mind not to add anything similar to this platform $\endgroup$ – Shawn May 11 '19 at 11:17

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.