Git Product home page Git Product logo

sigseg5 / nometa-tg Goto Github PK

View Code? Open in Web Editor NEW
6.0 6.0 3.0 104 KB

This is a Python Telegram bot that provides an opportunity to automatically delete all metadata from photo and apply Fawkes tool to hide you face from face recognition apps in social networks etc.

License: MIT License

Dockerfile 1.55% Python 98.45%
face-recognition metadata-remove privacy-enhancing-technologies privacy-protection python-telegram-bot

nometa-tg's People

Contributors

grbit avatar sigseg5 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

nometa-tg's Issues

Keras libraries problems

After I've built the docker image and run it, I've discovered some problems with keras library which is required by fawkes. I'm not sure, but maybe it could be fixed by specifying specific keras package version in reuirements.txt.

I've fixed it by entering the container (run docker exec -it $CONTAINER_NAME bash where $CONTAINER_NAME should be replaced with the name of container name which you can see by running docker ps) and changing some files:

  • /usr/local/lib/python3.7/site-packages/fawkes/utils.py change import line from from keras.preprocessing import image to import keras.utils as image at the beginning and in resize function definition.
  • /usr/local/lib/python3.7/site-packages/fawkes/differentiator.py change tf.keras.optimizers to tf.keras.optimizers.legacy

Then it start to work.

Here are some error:

Traceback (most recent call last):
  File "/usr/local/bin/fawkes", line 8, in <module>
    sys.exit(main())
  File "/usr/local/lib/python3.7/site-packages/fawkes/protection.py", line 201, in main
    separate_target=args.separate_target, debug=args.debug, no_align=args.no_align)
  File "/usr/local/lib/python3.7/site-packages/fawkes/protection.py", line 92, in run_protection
    image_paths, loaded_images = filter_image_paths(image_paths)
  File "/usr/local/lib/python3.7/site-packages/fawkes/utils.py", line 119, in filter_image_paths
    img = load_image(p)
  File "/usr/local/lib/python3.7/site-packages/fawkes/utils.py", line 109, in load_image
    image_array = image.img_to_array(img)
AttributeError: module 'keras.preprocessing.image' has no attribute 'img_to_array'
Traceback (most recent call last):
  File "/usr/local/bin/fawkes", line 8, in <module>
    sys.exit(main())
  File "/usr/local/lib/python3.7/site-packages/fawkes/protection.py", line 201, in main
    separate_target=args.separate_target, debug=args.debug, no_align=args.no_align)
  File "/usr/local/lib/python3.7/site-packages/fawkes/protection.py", line 128, in run_protection
    protected_images = generate_cloak_images(self.protector, original_images)
  File "/usr/local/lib/python3.7/site-packages/fawkes/protection.py", line 30, in generate_cloak_images
    cloaked_image_X = protector.compute(image_X, target_emb)
  File "/usr/local/lib/python3.7/site-packages/fawkes/differentiator.py", line 169, in compute
    target_imgs[idx:idx + self.batch_size] if target_imgs is not None else None)
  File "/usr/local/lib/python3.7/site-packages/fawkes/differentiator.py", line 248, in compute_batch
    optimizer.apply_gradients(zip(grad, [self.modifier]))
  File "/usr/local/lib/python3.7/site-packages/keras/optimizers/optimizer_experimental/optimizer.py", line 1140, in apply_gradients
    return super().apply_gradients(grads_and_vars, name=name)
  File "/usr/local/lib/python3.7/site-packages/keras/optimizers/optimizer_experimental/optimizer.py", line 634, in apply_gradients
    iteration = self._internal_apply_gradients(grads_and_vars)
  File "/usr/local/lib/python3.7/site-packages/keras/optimizers/optimizer_experimental/optimizer.py", line 1169, in _internal_apply_gradients
    grads_and_vars,
  File "/usr/local/lib/python3.7/site-packages/tensorflow/python/distribute/merge_call_interim.py", line 51, in maybe_merge_call
    return fn(strategy, *args, **kwargs)
  File "/usr/local/lib/python3.7/site-packages/keras/optimizers/optimizer_experimental/optimizer.py", line 1217, in _distributed_apply_gradients_fn
    var, apply_grad_to_update_var, args=(grad,), group=False
  File "/usr/local/lib/python3.7/site-packages/tensorflow/python/distribute/distribute_lib.py", line 2637, in update
    return self._update(var, fn, args, kwargs, group)
  File "/usr/local/lib/python3.7/site-packages/tensorflow/python/distribute/distribute_lib.py", line 3710, in _update
    return self._update_non_slot(var, fn, (var,) + tuple(args), kwargs, group)
  File "/usr/local/lib/python3.7/site-packages/tensorflow/python/distribute/distribute_lib.py", line 3716, in _update_non_slot
    result = fn(*args, **kwargs)
  File "/usr/local/lib/python3.7/site-packages/tensorflow/python/autograph/impl/api.py", line 595, in wrapper
    return func(*args, **kwargs)
  File "/usr/local/lib/python3.7/site-packages/keras/optimizers/optimizer_experimental/optimizer.py", line 1213, in apply_grad_to_update_var
    return self._update_step(grad, var)
  File "/usr/local/lib/python3.7/site-packages/keras/optimizers/optimizer_experimental/optimizer.py", line 217, in _update_step
    f"The optimizer cannot recognize variable {variable.name}. "
KeyError: 'The optimizer cannot recognize variable Variable:0. This usually means you are trying to call the optimizer to update different parts of the model separately. Please call `optimizer.build(variables)` with the full list of trainable variables before the training loop or use legacy optimizer `tf.keras.optimizers.legacy.{self.__class__.__name__}.'

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.