zuruoke / watermark-removal

a machine learning image inpainting task that instinctively removes watermarks from image indistinguishable from the ground truth image
1.93k stars 300 forks source link

Google Colab removed support for Tensorflow 1, and it is not possible to use %tensorflow_version 1.x magic anymore. #19

Open kaueramone opened 1 year ago

saraswat40 commented 1 year ago

You will need to use python 3.7 or older to install tensorflow 1.5. However, I went down this path via a docker image. Even when using the istock mask, it looks like it only works if the mask dimensions match the input image dimensions.

tedyyu commented 1 year ago

@saraswat40 can you kindly share such a out-of-box docker image? 😄

orhun commented 1 year ago

This will most likely do the job:

FROM python:3.7.16-slim-buster
WORKDIR /app
COPY . .
RUN apt-get update
RUN apt-get install -y \
  libgl1 \
  libglib2.0-0 \
  git \
  wget
RUN pip install --no-cache-dir \
  Pillow \
  opencv-python \
  tensorflow==1.15.0 \
  protobuf==3.20.* \
  git+https://github.com/JiahuiYu/neuralgym \
  pyyaml
RUN sed -i '/assert*/d' preprocess_image.py
RUN wget -O input.jpeg https://user-images.githubusercontent.com/51057490/140277929-3f187647-0e63-4bcb-b9f1-472f7558aae5.jpeg
ENTRYPOINT [ "sh", "-c", "python main.py --image input.jpeg --output output.jpeg --checkpoint_dir model/ --watermark_type istock" ] 
M4CC commented 1 year ago

Hello, can you break this down into steps one can feed into Colab please? Thank you!

M4CC commented 1 year ago

Ok, I got it to run but I still got the same error:

ERROR: Could not find a version that satisfies the requirement tensorflow==1.15.0 (from versions: 2.8.0rc0, 2.8.0rc1, 2.8.0, 2.8.1, 2.8.2, 2.8.3, 2.8.4, 2.9.0rc0, 2.9.0rc1, 2.9.0rc2, 2.9.0, 2.9.1, 2.9.2, 2.9.3, 2.10.0rc0, 2.10.0rc1, 2.10.0rc2, 2.10.0rc3, 2.10.0, 2.10.1, 2.11.0rc0, 2.11.0rc1, 2.11.0rc2, 2.11.0, 2.11.1, 2.12.0rc0, 2.12.0rc1, 2.12.0, 2.13.0rc0, 2.13.0rc1) ERROR: No matching distribution found for tensorflow==1.15.0

Any other ways to get this installed? Thank you!

orhun commented 1 year ago

I didn't use Colab and it worked for me. Not sure if Colab actually supports Python 3.7