Um simples projeto feito em Python (training) e TypeScript (proxy/tests) para remover o background de mangas. Fiz isso, pois leio mangas majoritariamente a noite.
Input | Output |
---|---|
Esse projeto usa U-Net, e foi implementado usando Tensorflow.
U-Net article:
Ronneberger, Olaf, Philipp Fischer, and Thomas Brox.
"U-net: Convolutional networks for biomedical image segmentation."
In International Conference on Medical Image Computing and Computer-Assisted Intervention, pp. 234-241. Springer, Cham, 2015.
Program | Vesion |
---|---|
Nodejs | v21.5.0 |
Python | v3.10.12 |
# Install fnm
apt install -y curl unzip
curl -fsSL https://fnm.vercel.app/install | bash
# rode o retorno do fnm, no meu caso:
# export PATH="/home/ashu/.local/share/fnm:$PATH"
eval "$(fnm env --use-on-cd)"
fnm install
fnm use
npm install
# For ARM64
npm rebuild @tensorflow/tfjs-node --build-from-source
# Start
npm run production
# Windowns WSL2: https://www.tensorflow.org/install/pip?hl=pt-br#windows-wsl2_1
# Install cuda: https://developer.nvidia.com/cuda-downloads
sudo apt install nvidia-cuda-toolkit
sudo apt install -y python3.10-venv libjpeg-dev zlib1g-dev
python3.10 -m venv ./
source bin/activate
pip install -r requirements.txt
pip install --upgrade pip setuptools wheel
pip install pillow --no-binary :all:
# Active venv
source bin/activate
# Look for the best result.
python training/start.py --unet --best
# Run a ready-made script.
python training/start.py --unet
pip freeze > .\requirements.txt
Causa: Esse erro é do próprio código.
Solução:
# Path: lib/python3.10/site-packages/tensorflowjs/converters/jax_conversion.py
# Remove:
from jax.experimental.jax2tf import shape_poly
PolyShape = shape_poly.PolyShape
# Add:
from jax.experimental.jax2tf import PolyShape
Causa: Possivelmente você desistalou e reinstalou o wsl/distro.
Solução:
# List the distributions installed, by running following in PowerShell.
wsl -l
# Unregister the distribution. Replace the "Ubuntu" below with your distribution name found in Step #1:
wsl --unregister Ubuntu-22.04
# Launch the Ubuntu (or other distribution) which was installed using Microsoft Store