Skip to content

Commit

Permalink
update readme dry_run
Browse files Browse the repository at this point in the history
  • Loading branch information
Peng Zhou committed May 14, 2019
1 parent 83e940d commit d0462ef
Show file tree
Hide file tree
Showing 20 changed files with 21 additions and 10 deletions.
14 changes: 12 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,20 +2,30 @@
Code for the GSRNet

# Environment
tensorflow 0.12.1, python3.4, cuda 8.0.44 cudnn 5.1
tensorflow 1.4.0, python3.4, cuda 8.0.44 cudnn 6.0

Other packages please run:
```
pip install -r requirements.txt
```

# Download ImageNet pre-trained model:

Refer to```https://github.com/DrSleep/tensorflow-deeplab-lfov``` for more detail

# Train the model:
Run ```train_default.sh```


# Test the model
1. python3 dry_run.py --model_weights='./snapshots/$FIXME' --dataset='$FIXME'

for single image, use --dataset='single_img'

2. save output image:
python3 dry_run.py --model_weights='./snapshots/$FIXME' --dataset='$FIXME' --save-dir='./output/$FIXME/'
python3 dry_run.py --model_weights='./snapshots/$FIXME' --dataset='$FIXME' --save-dir='./output/$FIXME/' --vis=True --F1=True

3. visualize generated images:
python3 dry_run.py --model_weights='./snapshots/$FIXME' --dataset='$FIXME' --save-dir='./output/$FIXME/' --vis=True --vis_gan=True


Binary file added __pycache__/DeepModel.cpython-34.pyc
Binary file not shown.
Binary file not shown.
Binary file added __pycache__/utils.cpython-34.pyc
Binary file not shown.
Binary file modified deeplab_resnet/__pycache__/__init__.cpython-34.pyc
Binary file not shown.
Binary file modified deeplab_resnet/__pycache__/image_reader.cpython-34.pyc
Binary file not shown.
Binary file modified deeplab_resnet/__pycache__/model.cpython-34.pyc
Binary file not shown.
Binary file modified deeplab_resnet/__pycache__/utils.cpython-34.pyc
Binary file not shown.
17 changes: 9 additions & 8 deletions dry_run.py
Original file line number Diff line number Diff line change
Expand Up @@ -286,12 +286,12 @@ def add_path(path):
args.img_path='../../dataset/COVERAGE'
data_file='cover_single_seg.txt'
elif args.dataset=='single_img':
data_file=None
img=tf.placeholder(dtype=tf.uint8, shape=(IMG_SIZE, IMG_SIZE, 3))
seg_mask=tf.placeholder(dtype=tf.uint8, shape=(IMG_SIZE, IMG_SIZE, 1))

image = tf.cast(img,tf.float32) - IMG_MEAN


if args.vis_gan:
tar_img=tf.placeholder(dtype=tf.uint8, shape=(IMG_SIZE, IMG_SIZE, 3))
target_image =tf.cast(tar_img,tf.float32) - IMG_MEAN
Expand Down Expand Up @@ -351,12 +351,13 @@ def add_path(path):
acc1=0
acc2=0
kernel = np.ones((15,15),np.uint8)
#with open(os.path.join(args.img_path,data_file)) as f:
#with open('./relight_lb.txt','r') as f:
#f=glob.glob('/vulcan/scratch/koutilya/core3d_data/new_RGB_data/RGB_real_corrupted_with_building_masks/input_image_*')
#f=glob.glob('/vulcan/scratch/venkai/CORE3D/superres/Data/yaser/input/Faceforensics_c23_2k/*.png')
f=glob.glob('/vulcan/scratch/venkai/CORE3D/superres/Data/yaser/results_SR_x2_rgb_L2/Faceforensics_c23_2k/*.png')
#f=[args.single_img]
if data_file:
f=open(os.path.join(args.img_path,data_file))
else:
#f=glob.glob('/vulcan/scratch/koutilya/core3d_data/new_RGB_data/RGB_real_corrupted_with_building_masks/input_image_*')
#f=glob.glob('/vulcan/scratch/venkai/CORE3D/superres/Data/yaser/input/Faceforensics_c23_2k/*.png')
f=glob.glob('/vulcan/scratch/venkai/CORE3D/superres/Data/yaser/results_SR_x2_rgb_L2/Faceforensics_c23_2k/*.png')
#f=[args.single_img]
if True:
for line in f:
imgname=line.split(' ')[0].strip()
Expand Down Expand Up @@ -423,7 +424,7 @@ def add_path(path):
tar_image_data=cv2.imread(tar_img_name)
tar_image_data=cv2.resize(tar_image_data,(IMG_SIZE,IMG_SIZE))

preds,pred_scores, edge_pred_scoresz, g_output_im,cp_im= sess.run([pred,pred_score,edge_pred_score,g_output,image_cp],{img:image_data.astype(np.uint8),tar_img:tar_image_data.astype(np.uint8),seg_mask:gt_mask[:,:,np.newaxis]})
preds,pred_scores, edge_pred_scores, g_output_im,cp_im= sess.run([pred,pred_score,edge_pred_score,g_output,image_cp],{img:image_data.astype(np.uint8),tar_img:tar_image_data.astype(np.uint8),seg_mask:gt_mask[:,:,np.newaxis]})

if not os.path.exists(args.save_dir +'/'+ os.path.splitext(os.path.basename(imgname))[0]+'_gan.png'):

Expand Down
Binary file modified kaffe/__pycache__/__init__.cpython-34.pyc
Binary file not shown.
Binary file modified kaffe/__pycache__/errors.cpython-34.pyc
Binary file not shown.
Binary file modified kaffe/__pycache__/graph.cpython-34.pyc
Binary file not shown.
Binary file modified kaffe/__pycache__/layers.cpython-34.pyc
Binary file not shown.
Binary file modified kaffe/__pycache__/shapes.cpython-34.pyc
Binary file not shown.
Binary file modified kaffe/__pycache__/transformers.cpython-34.pyc
Binary file not shown.
Binary file modified kaffe/caffe/__pycache__/__init__.cpython-34.pyc
Binary file not shown.
Binary file modified kaffe/caffe/__pycache__/resolver.cpython-34.pyc
Binary file not shown.
Binary file modified kaffe/tensorflow/__pycache__/__init__.cpython-34.pyc
Binary file not shown.
Binary file modified kaffe/tensorflow/__pycache__/network.cpython-34.pyc
Binary file not shown.
Binary file modified kaffe/tensorflow/__pycache__/transformer.cpython-34.pyc
Binary file not shown.

0 comments on commit d0462ef

Please sign in to comment.