Code Monkey home page Code Monkey logo

eegan's People

Contributors

kuijiang94 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

eegan's Issues

EEGAN_pretrained_doesn't work

Is there a new pretrained EEGAN weights file?
I got the following error message>
Key generator/conv_m2/weight not found in checkpoint

System:
tensorflow 1.10.0
python 3.6

TypeError: object of type 'NoneType' has no len()

When i try to run your python train.py code i get the error that says 'TypeError: object of type 'NoneType' has no len()'. I have looked a lot of platforms and it seems that ''The “TypeError: object of type 'NoneType' has no len() ” error is caused when you try to use the len() method on an object whose value is None. To solve this error, make sure that you are not assigning the responses of any built-in list methods, like sort() , to a variable.''. How do i figure this out. The code im getting the problem is below in line 38.

import numpy as np
import tensorflow as tf
from tqdm import tqdm
import argparse
import sys
sys.path.append('../utils')
from vgg19 import VGG19
import load
import augment

learning_rate = 1e-3
batch_size = 128

def train():
x = tf.placeholder(tf.float32, [None, 96, 96, 3])
t = tf.placeholder(tf.int32, [None])
is_training = tf.placeholder(tf.bool, [])

model = VGG19(x, t, is_training)
sess = tf.Session()
with tf.variable_scope('vgg19'):
    global_step = tf.Variable(0, name='global_step', trainable=False)
opt = tf.train.AdamOptimizer(learning_rate=learning_rate)
train_op = opt.minimize(model.loss, global_step=global_step)
init = tf.global_variables_initializer()
sess.run(init)

# Restore the latest model
if tf.train.get_checkpoint_state('backup/'):
    saver = tf.train.Saver()
    saver.restore(sess, 'backup/latest')

# Load the dataset
x_train, t_train, x_test, t_test = load.load()

# Train
while True:
    epoch = int(sess.run(global_step) / np.ceil(len(x_train)/batch_size)) + 1
    print('epoch:', epoch)
    perm = np.random.permutation(len(x_train))
    x_train = x_train[perm]
    t_train = t_train[perm]
    sum_loss_value = 0
    for i in tqdm(range(0, len(x_train), batch_size)):
        x_batch = augment.augment(x_train[i:i+batch_size])
        t_batch = t_train[i:i+batch_size]
        _, loss_value = sess.run(
            [train_op, model.loss],
            feed_dict={x: x_batch, t: t_batch, is_training: True})
        sum_loss_value += loss_value
    print('loss:', sum_loss_value)

    saver = tf.train.Saver()
    saver.save(sess, 'backup/latest', write_meta_graph=False)

    prediction = np.array([])
    answer = np.array([])
    for i in range(0, len(x_test), batch_size):
        x_batch = augment.augment(x_test[i:i+batch_size])
        t_batch = t_test[i:i+batch_size]
        output = model.out.eval(
            feed_dict={x: x_batch, is_training: False}, session=sess)
        prediction = np.concatenate([prediction, np.argmax(output, 1)])
        answer = np.concatenate([answer, t_batch])
        correct_prediction = np.equal(prediction, answer)
    accuracy = np.mean(correct_prediction)
    print('accuracy:', accuracy)

if name == 'main':
train()

Adsız

Missing dimension in the output test

Running test.py outputs 720x3 size images rather than 720x720x3.
What I did to fix that is to change this line

im = np.uint8(np.clip((img[0]+1)*127.5,0,255.0))

To this:

im = np.uint8(np.clip((img+1)*127.5,0,255.0))

I hope this is the correct fix, it seems to work

模型有误

江师兄您好,您上传的VGG19预训练模型和训练好的两个模型 是不是少东西 少了meta...

Dockerfile

I am using this Dockerfile in case it is useful:

FROM tensorflow/tensorflow:1.1.0-devel-gpu-py3

RUN apt update -y && apt-get install python3-tk -y
RUN pip3 install --upgrade pip

RUN pip3 install Pillow
RUN pip3 install opencv-python
RUN pip3 install tqdm requests

Then python3 within
Please let me know if any of you have something better

我前几天看到一篇EESRGAN做小目标检测的, 生成器部分引用的你的论文的网络结构。

train.py returning 3kb, single pixel width, images

Hello! When running train.py on the example image set the output are a series of single piexel width images. This is what I get in the console:

/home/jovyan/.local/lib/python3.6/site-packages/tensorflow/python/framework/dtypes.py:455: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.
_np_qint8 = np.dtype([("qint8", np.int8, 1)])
/home/jovyan/.local/lib/python3.6/site-packages/tensorflow/python/framework/dtypes.py:456: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.
_np_quint8 = np.dtype([("quint8", np.uint8, 1)])
/home/jovyan/.local/lib/python3.6/site-packages/tensorflow/python/framework/dtypes.py:457: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.
_np_qint16 = np.dtype([("qint16", np.int16, 1)])
/home/jovyan/.local/lib/python3.6/site-packages/tensorflow/python/framework/dtypes.py:458: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.
_np_quint16 = np.dtype([("quint16", np.uint16, 1)])
/home/jovyan/.local/lib/python3.6/site-packages/tensorflow/python/framework/dtypes.py:459: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.
_np_qint32 = np.dtype([("qint32", np.int32, 1)])
/home/jovyan/.local/lib/python3.6/site-packages/tensorflow/python/framework/dtypes.py:462: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.
np_resource = np.dtype([("resource", np.ubyte, 1)])
(720, 720, 3)
(1, 720, 720, 3)
2021-02-16 18:24:44.719827: W tensorflow/core/platform/cpu_feature_guard.cc:45] The TensorFlow library wasn't compiled to use SSE4.1 instructions, but these are available on your machine and could speed up CPU computations.
2021-02-16 18:24:44.720286: W tensorflow/core/platform/cpu_feature_guard.cc:45] The TensorFlow library wasn't compiled to use SSE4.2 instructions, but these are available on your machine and could speed up CPU computations.
2021-02-16 18:24:44.720335: W tensorflow/core/platform/cpu_feature_guard.cc:45] The TensorFlow library wasn't compiled to use AVX instructions, but these are available on your machine and could speed up CPU computations.
2021-02-16 18:24:44.720356: W tensorflow/core/platform/cpu_feature_guard.cc:45] The TensorFlow library wasn't compiled to use AVX2 instructions, but these are available on your machine and could speed up CPU computations.
2021-02-16 18:24:44.720461: W tensorflow/core/platform/cpu_feature_guard.cc:45] The TensorFlow library wasn't compiled to use FMA instructions, but these are available on your machine and could speed up CPU computations.
(720, 720, 3)
(1, 720, 720, 3)
(720, 720, 3)
(1, 720, 720, 3)
(720, 720, 3)
(1, 720, 720, 3)
(720, 720, 3)
(1, 720, 720, 3)
spent 410.88904190063477 s.

Any help hugely appreciated!

AttributeError: 'builtin_function_or_method' object has no attribute 'get_shape'

Getting the following error on executing test.py:

WARNING:tensorflow:From test.py:17: The name tf.reset_default_graph is deprecated. Please use tf.compat.v1.reset_default_graph instead.

WARNING:tensorflow:From test.py:20: The name tf.placeholder is deprecated. Please use tf.compat.v1.placeholder instead.

(720, 720, 3)
(1, 720, 720, 3)
Traceback (most recent call last):
  File "test.py", line 53, in <module>
    model = Model(x, is_training, 1)#16
  File "../TESTGAN.py", line 14, in __init__
    n,w,h,c = input.get_shape().as_list()
AttributeError: 'builtin_function_or_method' object has no attribute 'get_shape'

When I tried with tf.shape(input).as_list() instead of input.get_shape().as_list(), I got the following error:

WARNING:tensorflow:From test.py:17: The name tf.reset_default_graph is deprecated. Please use tf.compat.v1.reset_default_graph instead.

WARNING:tensorflow:From test.py:20: The name tf.placeholder is deprecated. Please use tf.compat.v1.placeholder instead.

(720, 720, 3)
(1, 720, 720, 3)
Traceback (most recent call last):
  File "/home/navaneeth/anaconda3/envs/image-sr-tf/lib/python3.6/site-packages/tensorflow_core/python/framework/tensor_util.py", line 541, in make_tensor_proto
    str_values = [compat.as_bytes(x) for x in proto_values]
  File "/home/navaneeth/anaconda3/envs/image-sr-tf/lib/python3.6/site-packages/tensorflow_core/python/framework/tensor_util.py", line 541, in <listcomp>
    str_values = [compat.as_bytes(x) for x in proto_values]
  File "/home/navaneeth/anaconda3/envs/image-sr-tf/lib/python3.6/site-packages/tensorflow_core/python/util/compat.py", line 71, in as_bytes
    (bytes_or_text,))
TypeError: Expected binary or unicode string, got <built-in function input>

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "test.py", line 53, in <module>
    model = Model(x, is_training, 1)#16
  File "../TESTGAN.py", line 14, in __init__
    n,w,h,c = tf.shape(input).as_list()
  File "/home/navaneeth/anaconda3/envs/image-sr-tf/lib/python3.6/site-packages/tensorflow_core/python/ops/array_ops.py", line 447, in shape
    return shape_internal(input, name, optimize=True, out_type=out_type)
  File "/home/navaneeth/anaconda3/envs/image-sr-tf/lib/python3.6/site-packages/tensorflow_core/python/ops/array_ops.py", line 471, in shape_internal
    input_tensor = ops.convert_to_tensor(input)
  File "/home/navaneeth/anaconda3/envs/image-sr-tf/lib/python3.6/site-packages/tensorflow_core/python/framework/ops.py", line 1184, in convert_to_tensor
    return convert_to_tensor_v2(value, dtype, preferred_dtype, name)
  File "/home/navaneeth/anaconda3/envs/image-sr-tf/lib/python3.6/site-packages/tensorflow_core/python/framework/ops.py", line 1242, in convert_to_tensor_v2
    as_ref=False)
  File "/home/navaneeth/anaconda3/envs/image-sr-tf/lib/python3.6/site-packages/tensorflow_core/python/framework/ops.py", line 1297, in internal_convert_to_tensor
    ret = conversion_func(value, dtype=dtype, name=name, as_ref=as_ref)
  File "/home/navaneeth/anaconda3/envs/image-sr-tf/lib/python3.6/site-packages/tensorflow_core/python/framework/constant_op.py", line 286, in _constant_tensor_conversion_function
    return constant(v, dtype=dtype, name=name)
  File "/home/navaneeth/anaconda3/envs/image-sr-tf/lib/python3.6/site-packages/tensorflow_core/python/framework/constant_op.py", line 227, in constant
    allow_broadcast=True)
  File "/home/navaneeth/anaconda3/envs/image-sr-tf/lib/python3.6/site-packages/tensorflow_core/python/framework/constant_op.py", line 265, in _constant_impl
    allow_broadcast=allow_broadcast))
  File "/home/navaneeth/anaconda3/envs/image-sr-tf/lib/python3.6/site-packages/tensorflow_core/python/framework/tensor_util.py", line 545, in make_tensor_proto
    "supported type." % (type(values), values))
TypeError: Failed to convert object of type <class 'builtin_function_or_method'> to Tensor. Contents: <built-in function input>. Consider casting elements to a supported type.

Could you please suggest a workaround?

what does it mean by 'model.ZConv_VDSR'?

Hello, thanks for your wonderful work!

İn the test.py, I met this problem, the model does not have contribute 'model.ZConv_VDSR'. I checked in the TESTGAN.py file, there is no definition. May I ask what does it mean by 'model.ZConv_VDSR'?
fake = sess.run(
[model.ZConv_VDSR],
feed_dict={x: input_, is_training: False})

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.