Giter VIP home page Giter VIP logo

face-detection-with-mobilenet-ssd's Introduction

Description

This is a implementation of mobilenet-ssd for face detection written by keras, which is the first step of my FaceID system. You can find another two repositories as follows:

  1. Face-detection-with-mobilenet-ssd
  2. Face-Alignment-with-simple-cnn
  3. Face-identification-with-cnn-triplet-loss

Prepare data

  1. You are advised to use CUDA-compatible GPUs to train the model.
  2. Download WIDER Face from Official Website , and put it into data_path folder in face_train.ipynb.
  3. wider_extract.py has been modified to show the method of exctracting faces from the datasets. It's easy to follow.

Requirements

  1. tensorflow >= 2.3
  2. python >= 3.5

Train

  1. Follow face_train.ipynb step by step. You can change the parameters for better performance.
  2. wider_train_small.npy and wider_val_small.npy are made to testing the network. If you don't have enough gpu resources, you can also use them for training.

Test

Here are some testing results. It seems good but improvement is still needed. For example, the Bbox is a little bit inaccurate.

To do

  1. Evaluation is on the way.
  2. MobileNetV2 version.

License

MIT LICENSE

References

  1. rykov8/ssd_keras
  2. rcmalli/keras-mobilenet

face-detection-with-mobilenet-ssd's People

Contributors

bruceyang2012 avatar zjuyang 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  avatar

face-detection-with-mobilenet-ssd's Issues

wider_extract.py

@bruceyang2012
Hello, it is a great research job.
Can you tell me how to generate the wider_extract.py files. I need to create my own data set.

Thank you very much!

widerface training

Hi yang shuang , thanks for sharing repo, it is really great work. if you let me , I will get a problem is sharing with you . When I trained wider face data by your face_train.ipynb , I got high val error . Also my epoch is 30 . I got min error 0.10801 .I dont understand why it happen. What can you say doing preprocessing for data , What is your plan to trian data

Translate

Hi,
Just wondering why you chose not to include any augmentations in the train_dataset.generate? For example, translation would enable the faces of the people on the ground in the second photo to be detected. I am going to implement something similar and was wondering if you had any rational behind not augmenting. Was it the training time?

Regards,
Moshe

bad bbox classification results

Hi @bruceyang2012 !

I'm trying to solve hand detection problem (2 classes: 'background' and 'hand') on custom dataset using your model. I've adjusted data to the desired format, so there is no problem with data loading.

However, after training I get the first 2 coordinates in y_pred [0.5, 0.5] in most of the cases, and [0.5+eps, 0.5-eps] in the rest minority, which means that model cannot classify bounding boxes and doesn't recognize "active" class (hand) at all.

I've tried to play with different parameters of SSDLoss(), like setting beta=2.0 and changing neg_pos_ratio and neg_min but it didn't change the picture.
Can you please give any suggestions on what to do next and what should I change to get reasonable classification results?

Thanks!

hi, error in executing:face_train.ipynb

Height, Width, Channels : 512 512 3
WARNING:tensorflow:The following Variables were used in a Lambda layer's call (tf.math.multiply_2), but are not present in its tracked objects: <tf.Variable 'detection_conv4_3_norm/detection_conv4_3_norm_gamma:0' shape=(512,) dtype=float32>. This is a strong indication that the Lambda layer should be rewritten as a subclassed Layer.
Freezing classification layers
classification layers freezed
loading classification weights

OSError Traceback (most recent call last)
in
30 print ("loading classification weights")
31 classification_model = './base_models/mobilenet_1_0_224_tf.h5'
---> 32 model.load_weights(classification_model, by_name= True)
33
34 print (colored( ('classification weights %s loaded' % classification_model), 'green'))

2 frames
/usr/local/lib/python3.7/dist-packages/h5py/_hl/files.py in make_fid(name, mode, userblock_size, fapl, fcpl, swmr)
188 if swmr and swmr_support:
189 flags |= h5f.ACC_SWMR_READ
--> 190 fid = h5f.open(name, flags, fapl=fapl)
191 elif mode == 'r+':
192 fid = h5f.open(name, h5f.ACC_RDWR, fapl=fapl)

h5py/_objects.pyx in h5py._objects.with_phil.wrapper()

h5py/_objects.pyx in h5py._objects.with_phil.wrapper()

h5py/h5f.pyx in h5py.h5f.open()

OSError: Unable to open file (file signature not found)

How can I reduce the size of the model

Hey, first of all great project. I'm having great fun working on this.

I trained my own model using my custom data on the architecture mentioned here. After training and quantization I'm getting a model of around 4.7MB. I wanted to decrease this size even further by maybe removing some of the layers. Can you point me on how to remove some layers to get the size lower?

Error while training

classification weights ./base_models/mobilenet_1_0_224_tf.h5 loaded
Traceback (most recent call last):
  File "face_train.py", line 119, in <module>
    box_output_format = ['class_id', 'xmin', 'xmax', 'ymin', 'ymax'])
TypeError: __init__() got an unexpected keyword argument 'image_set_path'

Getting this error while running the face_train code. Any lead will be helpful. thank you.

Two questions

Hello,
thanks for sharing.
I have two questions:

  1. I can do some training to reduce the val_loss under 0.5, however, when I test on single images, the result is wierd. Thus, is there a demo, how can I load the model and test it on single image, is it needed to transform it to the batch-format data?
  2. Second, if I do some my own training task, like hand detection task, will the transfer learning with coco or pascal-pretrained model be good?
    Thanks & Regards!

the model could not converge

Firstly, thanks for your sharing.
I tried to train the model on Pascalvoc2012 , and i got [email protected] = 0.22. It almost could not work.
I did training on coco, it didn’t converge. So I decided to check the model in using the same group of images as train and test dataset. The result should be 1,if the code was implemented right, but the actual result was closed to 0.

So I wonder whether there is an error in the code or the model could be trained successfully. i want to find where the mistake are.
I have checked the code many times, and please help me.
it is urgent.
many thanks.

There is an error in class AnchorBoxes.

In keras_layer_AnchorBoxes.py, there is an error in call() in class AnchorBoxes.
boxes_tensor[:, :, :, 2] = wh_list[:, 0] # Set w
boxes_tensor[:, :, :, 3] = wh_list[:, 1] # Set h
could not broadcast input array from shape (2) into shape (w, h, num_boxes)

Requirements

Can you add the requirements file with versions of libraries that are to be used

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.