Commit 0e917e49 authored by Rita-Josy Haddoub's avatar Rita-Josy Haddoub

Update README.md

parent 57272da9
......@@ -54,6 +54,67 @@ I went to the factory where they make concrete slabs. The factory makes some in
The concrete block has a very common shape and use, it is either a perfect block, or it is a bit shattered down or broken. But it is never slightly morphed or bended with smooth curves. The fact that it dries so quickly explained it. The morphed Beton did startle some people who saw it, wondering what it was, or how it came to be. I am excited by this possibility of having a morphed Beton, it certainly does feel uncanny. Without the direction and vision of the GAN I would not have known how to mend the block. It could have easily looked like shattered stone, but the GAN highlighted and emphasized the main features to be manipulated.
# Using the Model
The model can be updated with more data and training. It may also be used as it is on a single photo to get its latent conversion by doing a test run.
### Further Train the model
Open Terminal or command prompt, and cd into cloned or downloaded pix2pix.
```ruby
# clone pix2pix library
git clone https://github.com/affinelayer/pix2pix-tensorflow.git
cd pix2pix-tensorflow
# clone Beton Dataset within pix2xpix library
git clone https://gitlab.doc.gold.ac.uk/rhadd001/beton.git
#(Before training, you may just add source photos to the Beton_ImageDataset and git push back into the source code)
#Prepare Images for model, Add photo to the ‘original’ folder >> /beton/pix2pix_model/betonphotos/original
#Pre-process data for in-painting method.
#Resize source images
python tools/process.py \
--input_dir betonphotos/original \
--operation resize \
output_dir photos/resized
# Create images with blank centers
python tools/process.py \
--input_dir betonphotos/resized \
--operation blank \
--output_dir betonphotos/blank
# Combine resized imaged with blanked images
python tools/process.py \
--input_dir betonphotos/resized \
--b_dir betonphotos/blank \
--operation combine \
--output_dir betonphotos/combined
# Split into train/val set
python tools/split.py \
--dir betonphotos/combined
# Train the model (took me more than 10 hours on a MacBook pro. 2 days if max_epochs=200)
python pix2pix.py \
--mode train \
--output_dir beton_train \
--max_epochs 50 \
--input_dir betonphotos/combined/train \
--which_direction BtoA
# Test the model
python pix2pix.py \
--mode test \
--output_dir beton_test \
--input_dir betonphotos/combined/val \
--checkpoint beton_train
```
### Convert own image without Training
First, Follow the steps above, by pre-processing your photo. (Resize to 256x256, make a Blank center, and create an image pair.)
Put your image pair in its own folder ‘myimage’, and test the model as above with two adjustment to the input and output directory.
--output_dir mytest\
--input_dir betonphotos/myimage\
This will result with a new file ’mytest’ that has an HTML file including an input/output/target image made by the model.
# Acknowledgements
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment