GithubHelp home page GithubHelp logo

nghorbani / homogenus Goto Github PK

View Code? Open in Web Editor NEW
113.0 113.0 24.0 4.24 MB

Human Image Gender Classifier for Expressive Body Capture

Home Page: https://smpl-x.is.tue.mpg.de/

License: Other

Python 100.00%
gender-classification human machine-learning openpose smpl-x

homogenus's Introduction

A Github Pages template for academic websites. This was forked (then detached) by Stuart Geiger from the Minimal Mistakes Jekyll Theme, which is © 2016 Michael Rose and released under the MIT License. See LICENSE.md.

I think I've got things running smoothly and fixed some major bugs, but feel free to file issues or make pull requests if you want to improve the generic template / theme.

Note: if you are using this repo and now get a notification about a security vulnerability, delete the Gemfile.lock file.

Instructions

  1. Register a GitHub account if you don't have one and confirm your e-mail (required!)
  2. Fork this repository by clicking the "fork" button in the top right.
  3. Go to the repository's settings (rightmost item in the tabs that start with "Code", should be below "Unwatch"). Rename the repository "[your GitHub username].github.io", which will also be your website's URL.
  4. Set site-wide configuration and create content & metadata (see below -- also see this set of diffs showing what files were changed to set up an example site for a user with the username "getorg-testacct")
  5. Upload any files (like PDFs, .zip files, etc.) to the files/ directory. They will appear at https://[your GitHub username].github.io/files/example.pdf.
  6. Check status by going to the repository settings, in the "GitHub pages" section
  7. (Optional) Use the Jupyter notebooks or python scripts in the markdown_generator folder to generate markdown files for publications and talks from a TSV file.

See more info at https://academicpages.github.io/

To run locally (not on GitHub Pages, to serve on your own computer)

  1. Clone the repository and made updates as detailed above
  2. Make sure you have ruby-dev, bundler, and nodejs installed: sudo apt install ruby-dev ruby-bundler nodejs
  3. Run bundle clean to clean up the directory (no need to run --force)
  4. Run bundle install to install ruby dependencies. If you get errors, delete Gemfile.lock and try again.
  5. Run bundle exec jekyll liveserve to generate the HTML and serve it from localhost:4000 the local server will automatically rebuild and refresh the pages on change.

Changelog -- bugfixes and enhancements

There is one logistical issue with a ready-to-fork template theme like academic pages that makes it a little tricky to get bug fixes and updates to the core theme. If you fork this repository, customize it, then pull again, you'll probably get merge conflicts. If you want to save your various .yml configuration files and markdown files, you can delete the repository and fork it again. Or you can manually patch.

To support this, all changes to the underlying code appear as a closed issue with the tag 'code change' -- get the list here. Each issue thread includes a comment linking to the single commit or a diff across multiple commits, so those with forked repositories can easily identify what they need to patch.

homogenus's People

Contributors

dependabot[bot] avatar nghorbani 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

homogenus's Issues

pretrained weights

i followed all the instructions but got an error that i could not resolve
File "/home/wise/testing/homogenus/homogenus/tf/homogenus_infer.py", line 174, in
hg = Homogenus_infer(trained_model_dir=ps.trained_model_dir)
File "/home/wise/testing/homogenus/homogenus/tf/homogenus_infer.py", line 47, in init
self.model = tf.keras.models.load_model(self.best_model_fname)
File "/home/wise/testing/myenv/lib/python3.10/site-packages/keras/src/saving/saving_api.py", line 262, in load_model
return legacy_sm_saving_lib.load_model(
File "/home/wise/testing/myenv/lib/python3.10/site-packages/keras/src/utils/traceback_utils.py", line 70, in error_handler
raise e.with_traceback(filtered_tb) from None
File "/home/wise/testing/myenv/lib/python3.10/site-packages/keras/src/saving/legacy/save.py", line 234, in load_model
raise IOError(
OSError: No file or directory found at ./homogenus/trained_models/tf/TR02_E02_It_002010.ckpt
(myenv) wise@wise-Victus-by-HP-Gaming-Laptop-15-fb0xxx:~/testing/homogenus$

i downloaed the weights but i only have the .index , .meta and .00104.0014

Problems in installing and running [SOLUTION]

Greetings and thank you for this awesome project!

I got the following problem when I installed the dependencies:

error: numpy 1.16.3 is installed but numpy>=1.17 is required by {'matplotlib'}
error: numpy 1.16.3 is installed but numpy>=1.17.3 is required by {'PyWavelets'}

I resolved the problem by changing the dependencies in requirements.txt:

numpy==1.17.3

Then I got this wall of text error when I tried to run inference:

$ python3 homogenus/tf/homogenus_infer.py -h
Traceback (most recent call last):
  File "homogenus/tf/homogenus_infer.py", line 21, in <module>
    import tensorflow as tf
  File "/home/.../source/homogenus/.venv/lib/python3.7/site-packages/tensorflow/__init__.py", line 24, in <module>
    from tensorflow.python import pywrap_tensorflow  # pylint: disable=unused-import
  File "/home/.../source/homogenus/.venv/lib/python3.7/site-packages/tensorflow/python/__init__.py", line 52, in <module>
    from tensorflow.core.framework.graph_pb2 import *
  File "/home/.../source/homogenus/.venv/lib/python3.7/site-packages/tensorflow/core/framework/graph_pb2.py", line 15, in <module>
    from tensorflow.core.framework import node_def_pb2 as tensorflow_dot_core_dot_framework_dot_node__def__pb2
  File "/home/.../source/homogenus/.venv/lib/python3.7/site-packages/tensorflow/core/framework/node_def_pb2.py", line 15, in <module>
    from tensorflow.core.framework import attr_value_pb2 as tensorflow_dot_core_dot_framework_dot_attr__value__pb2
  File "/home/.../source/homogenus/.venv/lib/python3.7/site-packages/tensorflow/core/framework/attr_value_pb2.py", line 15, in <module>
    from tensorflow.core.framework import tensor_pb2 as tensorflow_dot_core_dot_framework_dot_tensor__pb2
  File "/home/.../source/homogenus/.venv/lib/python3.7/site-packages/tensorflow/core/framework/tensor_pb2.py", line 15, in <module>
    from tensorflow.core.framework import resource_handle_pb2 as tensorflow_dot_core_dot_framework_dot_resource__handle__pb2
  File "/home/.../source/homogenus/.venv/lib/python3.7/site-packages/tensorflow/core/framework/resource_handle_pb2.py", line 41, in <module>
    serialized_options=None, file=DESCRIPTOR),
  File "/home/.../source/homogenus/.venv/lib/python3.7/site-packages/google/protobuf/descriptor.py", line 560, in __new__
    _message.Message._CheckCalledFromGeneratedFile()
TypeError: Descriptors cannot not be created directly.
If this call came from a _pb2.py file, your generated code is out of date and must be regenerated with protoc >= 3.19.0.
If you cannot immediately regenerate your protos, some other possible workarounds are:
 1. Downgrade the protobuf package to 3.20.x or lower.
 2. Set PROTOCOL_BUFFERS_PYTHON_IMPLEMENTATION=python (but this will use pure-Python parsing and will be much slower).

More information: https://developers.google.com/protocol-buffers/docs/news/2022-05-06#python-updates

Then I headed to the link to check what's going on. It looks like this has something to do with tensorflow and protocol buffers. My tf version:

1.13.1

It's not 1.15.2 because I tried this PR.

My protobuf version:

4.21.2

I have a few options:

  • upgrade tensorflow to 2.x
  • downgrade protobuf to 3.20.x or lower.

You can see the PRs for changing requirements in this repo. I didn't test them yet. This is what worked for me:

$ pip install protobuf==3.20
Collecting protobuf==3.20
  Using cached protobuf-3.20.0-cp37-cp37m-manylinux_2_5_x86_64.manylinux1_x86_64.whl (1.0 MB)
ERROR: homogenus .5 has requirement numpy==1.17.3, but you'll have numpy 1.16.3 which is incompatible.
Installing collected packages: protobuf
  Attempting uninstall: protobuf
    Found existing installation: protobuf 4.21.2
    Uninstalling protobuf-4.21.2:
      Successfully uninstalled protobuf-4.21.2
Successfully installed protobuf-3.20.0

Even though I got the warning it worked for me in the end. Test to validate this:

$ python3 homogenus/tf/homogenus_infer.py -h
usage: homogenus_infer.py [-h] [-tm TRAINED_MODEL_DIR] -ii IMAGES_INDIR -oi
                          OPENPOSE_INDIR [-io IMAGES_OUTDIR]
                          [-oo OPENPOSE_OUTDIR]

optional arguments:
  -h, --help            show this help message and exit
  -tm TRAINED_MODEL_DIR, --trained_model_dir TRAINED_MODEL_DIR
                        The path to the directory holding homogenus trained
                        models in TF.
  -ii IMAGES_INDIR, --images_indir IMAGES_INDIR
                        Directory of the input images.
  -oi OPENPOSE_INDIR, --openpose_indir OPENPOSE_INDIR
                        Directory of openpose keypoints, e.g. json files.
  -io IMAGES_OUTDIR, --images_outdir IMAGES_OUTDIR
                        Directory to put predicted gender overlays. If not
                        given, wont produce any overlays.
  -oo OPENPOSE_OUTDIR, --openpose_outdir OPENPOSE_OUTDIR
                        Directory to put the openpose gendered keypoints. If
                        not given, it will augment the original openpose json
                        files.

Just for convenience, here's my setup.

  • Ubuntu 20.04
  • Python 3.7

I used venv, but you can do similar with conda if that rocks your boat.

python3.7 -m venv .venv
source .venv/bin/activate
$ pip freeze
absl-py==1.1.0
astor==0.8.1
cycler==0.11.0
fonttools==4.34.4
gast==0.2.2
google-pasta==0.2.0
grpcio==1.47.0
h5py==3.7.0
homogenus===.5
imageio==2.5.0
importlib-metadata==4.12.0
Keras-Applications==1.0.8
Keras-Preprocessing==1.1.2
kiwisolver==1.4.3
Markdown==3.3.7
matplotlib==3.5.2
mock==4.0.3
networkx==2.6.3
numpy==1.16.3
opt-einsum==3.3.0
packaging==21.3
Pillow==9.2.0
protobuf==3.20.0
pyparsing==3.0.9
python-dateutil==2.8.2
PyWavelets==1.3.0
scikit-image==0.15.0
scikit-learn==0.20.3
scipy==1.2.1
six==1.16.0
tensorboard==1.13.1
tensorflow==1.13.1
tensorflow-estimator==1.13.0
termcolor==1.1.0
typing_extensions==4.3.0
Werkzeug==2.1.2
wrapt==1.14.1
zipp==3.8.1

You could do the same with different tensorflow versions: just downgrade protobuf and hope for the best. I hope this helps someone else and saves them the 30 minutes I used for this :)

Prediction label

Excuse me. Can you tell me whether I can change the output of male/ female/ neutral into male/ female? 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.