Giter Site home page Giter Site logo

yolokerasfacedetection's People

Contributors

abars 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  avatar  avatar  avatar  avatar  avatar  avatar

yolokerasfacedetection's Issues

'NoneType' object is not subscriptable

TypeError                                 Traceback (most recent call last)
/mnt/YoloKerasFaceDetection/agegender_demo.py in <module>
    377 
    378 if __name__=='__main__':
--> 379         main(sys.argv[1:])

/mnt/YoloKerasFaceDetection/agegender_demo.py in main(argv)
    357 
    358                 img=frame
--> 359                 img = img[...,::-1]  #BGR 2 RGB
    360                 inputs = img.copy() / 255.0
    361 

TypeError: 'NoneType' object is not subscriptable

Feature request: YOLO V3

Great job, but I am facing difficulties while it cannot detect all faces in some cases.
Please upgrade the face detection library to YOLO v3 or other more advanced one.

Video frame openning Error

VIDEOIO ERROR: V4L2: Pixel format of incoming image is unsupported by OpenCV
Unable to stop the stream: Device or resource busy
Traceback (most recent call last):
File "agegender_demo.py", line 322, in
main(sys.argv[1:])
File "agegender_demo.py", line 297, in main
img = img_bgr[...,::-1]
TypeError: 'NoneType' object has no attribute 'getitem'

yolov2_tiny-face.h5 with Unity

Hi, I am trying to use the pre-trained face detection model in unity. To do that I know I have to convert the model to .onnx or .pb first and I do that. However, when I import the model into the resources and check the model in unity I see several issues. One of them is the shape of the input which I believe needs to be (1, 416, 416, 3), whereas it is (1, 416, 3, 416). In addition, Unity gives me two warnings:

  1. "adjusted_input8: Unknown type encountered while parsing layer adjusted_input8 of type Transpose. We replace by an identity layer."
  2. "transpose_output: Unknown type encountered while parsing layer transpose_output of type Transpose. We replace by an identity layer."

Due to either the warnings or input shape or both, right now I am not getting any detection. Any help would be much appreciated.

贡献一个download_model的py3版本

Download pretrained model

import os
import sys
from urllib import request

def main(argv):
output_path = "./pretrain/"
if not os.path.isdir(output_path):
os.mkdir(output_path)
with open(output_path+'agegender_age101_squeezenet.hdf5', 'wb') as f:
f.write(request.urlopen("http://www.abars.biz/keras/agegender_age101_squeezenet.hdf5").read())
f.close()
print("1/3")
with open(output_path+'agegender_gender_squeezenet.hdf5', 'wb') as f:
f.write(request.urlopen("http://www.abars.biz/keras/agegender_gender_squeezenet.hdf5").read())
f.close()
print("2/3")
with open(output_path+'yolov2_tiny-face.h5', 'wb') as f:
f.write(request.urlopen("http://www.abars.biz/keras/yolov2_tiny-face.h5").read())
f.close()
print("3/3")

if name == 'main':
print("start...")
main(sys.argv[1:])

the model was *not* compiled

ipython agegender_demo.py 
Using TensorFlow backend.
2019-02-03 18:48:51.822535: I tensorflow/core/platform/cpu_feature_guard.cc:141] Your CPU supports instructions that this TensorFlow binary was not compiled to use: AVX2 FMA
/usr/local/lib/python3.6/site-packages/keras/engine/saving.py:292: UserWarning: No training configuration found in save file: the model was *not* compiled. Compile it manually.
  warnings.warn('No training configuration found in save file:

AttributeError: 'NoneType' object has no attribute 'output' in agegender_train.py

I am using the command $ python agegender_train.py gender squeezenet imdb

So first there was an error in squeezenet.py in keras_squeezenet of

ImportError: cannot import name 'warnings' which I removed by commenting out the warnings section as it was just a print statement. So no more problem with the squeezenet.py but another has occured in the agegender_train.py in line 157

line 154: from keras_squeezenet import SqueezeNet
line 155: input_tensor = Input(shape=(IMAGE_SIZE, IMAGE_SIZE, 3))
line 156: base_model = SqueezeNet(weights="imagenet", include_top=False, input_tensor=input_tensor)

line 157: x = base_model.output

line 158: x = GlobalAveragePooling2D()(x)
line 159: x = Dense(1024, activation='relu')(x)

File "/home/user/Documents/YoloKerasFaceDetection-master/agegender_train.py", line 157, in <module> x = base_model.output AttributeError: 'NoneType' object has no attribute 'output'

how can I get boxes when run yolov2_tiny-face.h5

Hello, I'm a newbie
I want to gets boxes from yolov2_tiny-face.h5. Here is my code

from keras.models import load_model
from PIL import Image, ImageDraw
import numpy as np

input_image = Image.open('test.jpg')
image = input_image.resize((416, 416))
image = np.array(image)
image = image / 255.
image = np.expand_dims(image, 0)

model = load_model('yolov2_tiny-face.h5')
model.summary()
outputs = model.predict(image)

I got outputs.shape = (1, 13, 13, 30), same as last layer's shape, seem not correct
Could you help me please!

Non-converted model

Can you share the non-converted model? I.e the darknet weights before moving them to keras. It would help for fine-tuning/transfer learning of other tasks.

THanks!

working demo

The demo as is gives no detections for any of the examples in the examples dir...

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

I received this error when I ran

python3 agender_demo.py

Please let me know how to solve this.

Traceback (most recent call last):
  File "agegender_demo.py", line 376, in <module>
    main(sys.argv[1:])
  File "agegender_demo.py", line 336, in main
    model_age = load_model(MODEL_ROOT_PATH+'agegender_age101_squeezenet.hdf5')
  File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/keras/engine/saving.py", line 417, in load_model
    f = h5dict(filepath, 'r')
  File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/keras/utils/io_utils.py", line 186, in __init__
    self.data = h5py.File(path, mode=mode)
  File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/h5py/_hl/files.py", line 394, in __init__
    swmr=swmr)
  File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/h5py/_hl/files.py", line 170, in make_fid
    fid = h5f.open(name, flags, fapl=fapl)
  File "h5py/_objects.pyx", line 54, in h5py._objects.with_phil.wrapper
  File "h5py/_objects.pyx", line 55, in h5py._objects.with_phil.wrapper
  File "h5py/h5f.pyx", line 85, in h5py.h5f.open
OSError: Unable to open file (file signature not found)

cant import load_model from keras

Hi after following each and every step but still i face this error

/home/mohammad/anaconda3/envs/Yolokeras/lib/python3.5/site-packages/h5py/init.py:36: FutureWarning: Conversion of the second argument of issubdtype from float to np.floating is deprecated. In future, it will be treated as np.float64 == np.dtype(float).type.
from ._conv import register_converters as _register_converters
Using TensorFlow backend.
Traceback (most recent call last):
File "agegender_demo.py", line 18, in
from keras.models import load_model

File "/home/mohammad/anaconda3/envs/Yolokeras/lib/python3.5/site-packages/keras/init.py", line 3, in
from . import utils
File "/home/mohammad/anaconda3/envs/Yolokeras/lib/python3.5/site-packages/keras/utils/init.py", line 6, in
from . import conv_utils
File "/home/mohammad/anaconda3/envs/Yolokeras/lib/python3.5/site-packages/keras/utils/conv_utils.py", line 9, in
from .. import backend as K
File "/home/mohammad/anaconda3/envs/Yolokeras/lib/python3.5/site-packages/keras/backend/init.py", line 89, in
from .tensorflow_backend import *
File "/home/mohammad/anaconda3/envs/Yolokeras/lib/python3.5/site-packages/keras/backend/tensorflow_backend.py", line 5, in
import tensorflow as tf
File "/home/mohammad/anaconda3/envs/Yolokeras/lib/python3.5/site-packages/tensorflow/init.py", line 22, in
from tensorflow.python import pywrap_tensorflow # pylint: disable=unused-import
File "/home/mohammad/anaconda3/envs/Yolokeras/lib/python3.5/site-packages/tensorflow/python/init.py", line 52, in
from tensorflow.core.framework.graph_pb2 import *
File "/home/mohammad/anaconda3/envs/Yolokeras/lib/python3.5/site-packages/tensorflow/core/framework/graph_pb2.py", line 15, in
from tensorflow.core.framework import node_def_pb2 as tensorflow_dot_core_dot_framework_dot_node__def__pb2
File "/home/mohammad/anaconda3/envs/Yolokeras/lib/python3.5/site-packages/tensorflow/core/framework/node_def_pb2.py", line 15, in
from tensorflow.core.framework import attr_value_pb2 as tensorflow_dot_core_dot_framework_dot_attr__value__pb2
File "/home/mohammad/anaconda3/envs/Yolokeras/lib/python3.5/site-packages/tensorflow/core/framework/attr_value_pb2.py", line 15, in
from tensorflow.core.framework import tensor_pb2 as tensorflow_dot_core_dot_framework_dot_tensor__pb2
File "/home/mohammad/anaconda3/envs/Yolokeras/lib/python3.5/site-packages/tensorflow/core/framework/tensor_pb2.py", line 15, in
from tensorflow.core.framework import resource_handle_pb2 as tensorflow_dot_core_dot_framework_dot_resource__handle__pb2
File "/home/mohammad/anaconda3/envs/Yolokeras/lib/python3.5/site-packages/tensorflow/core/framework/resource_handle_pb2.py", line 22, in
serialized_pb=_b('\n/tensorflow/core/framework/resource_handle.proto\x12\ntensorflow"r\n\x13ResourceHandleProto\x12\x0e\n\x06\x64\x65vice\x18\x01 \x01(\t\x12\x11\n\tcontainer\x18\x02 \x01(\t\x12\x0c\n\x04name\x18\x03 \x01(\t\x12\x11\n\thash_code\x18\x04 \x01(\x04\x12\x17\n\x0fmaybe_type_name\x18\x05 \x01(\tBn\n\x18org.tensorflow.frameworkB\x0eResourceHandleP\x01Z=github.com/tensorflow/tensorflow/tensorflow/go/core/framework\xf8\x01\x01\x62\x06proto3')
TypeError: new() got an unexpected keyword argument 'serialized_options'

Following error occurs while running python agegender_demo.py file

Using TensorFlow backend.
Traceback (most recent call last):
File "agegender_demo.py", line 377, in
main(sys.argv[1:])
File "agegender_demo.py", line 335, in main
model_face = load_model(MODEL_ROOT_PATH+'yolov2_tiny-face.h5')
File "/home/sakhita/.local/lib/python2.7/site-packages/keras/models.py", line 128, in load_model
model = model_from_config(model_config, custom_objects=custom_objects)
File "/home/sakhita/.local/lib/python2.7/site-packages/keras/models.py", line 177, in model_from_config
return layer_from_config(config, custom_objects=custom_objects)
File "/home/sakhita/.local/lib/python2.7/site-packages/keras/utils/layer_utils.py", line 36, in layer_from_config
return layer_class.from_config(config['config'])
File "/home/sakhita/.local/lib/python2.7/site-packages/keras/engine/topology.py", line 2375, in from_config
process_layer(layer_data)
File "/home/sakhita/.local/lib/python2.7/site-packages/keras/engine/topology.py", line 2353, in process_layer
custom_objects=custom_objects)
File "/home/sakhita/.local/lib/python2.7/site-packages/keras/utils/layer_utils.py", line 36, in layer_from_config
return layer_class.from_config(config['config'])
File "/home/sakhita/.local/lib/python2.7/site-packages/keras/engine/topology.py", line 929, in from_config
return cls(**config)
TypeError: init() got an unexpected keyword argument 'dtype'

can anyone please tell me how to correct this.

Emotion Model

Does anyone have 'fer2013_mini_XCEPTION.102-0.66.hdf5' , the emotion detection model

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.