PeterWang512 / GANSketching

Sketch Your Own GAN: Customizing a GAN model with hand-drawn sketches.
https://peterwang512.github.io/GANSketching
MIT License
711 stars 95 forks source link

Evaluation script error #10

Open WitchDD opened 2 years ago

WitchDD commented 2 years ago

Thank you friends for suggesting interesting things! python run_metrics.py --models_list weights / eval_list --outputmetric_results.csv

When I do this I get this error: usage: run_metrics.py [-h] [--models_list MODELS_LIST] [--output OUTPUT] [--model_root MODEL_ROOT] [--eval_root EVAL_ROOT] [--sample_root SAMPLE_ROOT] [--batch_size BATCH_SIZE] [--eval_samples EVAL_SAMPLES] [--device DEVICE] run_metrics.py: error: unrecognized arguments: / eval_list --outputmetric_results.csv

It looks like the arguments aren't working. I want you to find a concrete solution. thank you!

PeterWang512 commented 2 years ago

Can you try removing the space like this? python run_metrics.py --models_list weights/eval_list --output metric_results.csv

WitchDD commented 2 years ago

Another error will occur. `al_list --output metric_results.csv multiprocessing.pool.RemoteTraceback: """ Traceback (most recent call last): File "/home/test/anaconda3/envs/gan/lib/python3.6/multiprocessing/pool.py", line 119, in worker result = (True, func(*args, **kwds)) File "/home/test/GANSketching/run_metrics.py", line 105, in run_vgg from eval.precision_recall import metrics as pr ImportError: cannot import name 'metrics' """

The above exception was the direct cause of the following exception:

Traceback (most recent call last): File "run_metrics.py", line 155, in metrics[name] = get_metrics(opt, name, target) File "run_metrics.py", line 56, in get_metrics stats_fake = get_stats(opt, g, fake_folder) File "run_metrics.py", line 87, in get_stats vgg_features = get_vgg_features(folder, opt.eval_samples, opt.batch_size) File "run_metrics.py", line 101, in get_vgg_features return p.apply(run_vgg, (folder, eval_samples, batch_size,)) File "/home/test/anaconda3/envs/gan/lib/python3.6/multiprocessing/pool.py", line 259, in apply return self.apply_async(func, args, kwds).get() File "/home/test/anaconda3/envs/gan/lib/python3.6/multiprocessing/pool.py", line 644, in get raise self._value ImportError: cannot import name 'metrics' `

PeterWang512 commented 2 years ago

It could be that you haven't pulled the submodules. I would try running git submodule update --init --recursive in the repo and then run the script.

WitchDD commented 2 years ago

As instructed, I ran it in the following order, but I get the same error.

①git submodule update --init --recursive ②bash scripts/train_teaser_cat.sh ③Access 'https://wandb.ai'  -> The execution result is generated in / GANSketching / wandb. ④python run_metrics.py --models_list weights/eval_list --output metric_results.csv   ->Here, the previous error appears

PeterWang512 commented 2 years ago

Can you check if metrics.py exists in eval/precision_recall? It should exist if you pulled the submodules

WitchDD commented 2 years ago

eval/precision_recall was missing metrics.py

Why doesn't git submodule update --init --recursive respond?

PeterWang512 commented 2 years ago

I'm not sure about the cause, but as a temporary fix, you can pull the precision_recall directly at here: https://github.com/PeterWang512/precision_recall and move the folder to in the eval folder

WitchDD commented 2 years ago

I installed tensorflow-gpu == 1.5.0 because of a dnnlib error. However, this new error has occurred and I would like to ask for a solution.

`al_list --output metric_results.csv /home/anaconda3/envs/gan/lib/python3.6/site-packages/tensorflow/python/framework/dtypes.py:493: 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/anaconda3/envs/gan/lib/python3.6/site-packages/tensorflow/python/framework/dtypes.py:494: 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/anaconda3/envs/gan/lib/python3.6/site-packages/tensorflow/python/framework/dtypes.py:495: 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/anaconda3/envs/gan/lib/python3.6/site-packages/tensorflow/python/framework/dtypes.py:496: 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/anaconda3/envs/gan/lib/python3.6/site-packages/tensorflow/python/framework/dtypes.py:497: 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/anaconda3/envs/gan/lib/python3.6/site-packages/tensorflow/python/framework/dtypes.py:502: 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)]) multiprocessing.pool.RemoteTraceback: """ Traceback (most recent call last): File "/home/anaconda3/envs/gan/lib/python3.6/multiprocessing/pool.py", line 119, in worker result = (True, func(*args, **kwds)) File "/home/GANSketching/run_metrics.py", line 105, in run_vgg from eval.precision_recall import metrics as pr File "/home/GANSketching/eval/precision_recall/metrics.py", line 13, in from utils import init_tf ImportError: cannot import name 'init_tf' """

The above exception was the direct cause of the following exception:

Traceback (most recent call last): File "run_metrics.py", line 155, in metrics[name] = get_metrics(opt, name, target) File "run_metrics.py", line 56, in get_metrics stats_fake = get_stats(opt, g, fake_folder) File "run_metrics.py", line 87, in get_stats vgg_features = get_vgg_features(folder, opt.eval_samples, opt.batch_size) File "run_metrics.py", line 101, in get_vgg_features return p.apply(run_vgg, (folder, eval_samples, batch_size,)) File "/home/anaconda3/envs/gan/lib/python3.6/multiprocessing/pool.py", line 259, in apply return self.apply_async(func, args, kwds).get() File "/home/anaconda3/envs/gan/lib/python3.6/multiprocessing/pool.py", line 644, in get raise self._value ImportError: cannot import name 'init_tf' `

PeterWang512 commented 2 years ago

I'll look into this issue, and see if I can reproduce this error. Stay tuned!