AGE icon indicating copy to clipboard operation
AGE copied to clipboard

Questions about the "get_class_embedding.py" file

Open zj916716524 opened this issue 2 years ago • 5 comments

Hello. I came across your paper and found it very interesting, so I downloaded the code to run it myself. And I want to make my own dataset, I have modified the paths_config.py files. When I run the get_class_embedding.py file, unfortunately it gives me this error "ImportError: No module named 'fused'"

zj916716524 avatar Mar 24 '22 14:03 zj916716524

Could you provide the detail of your error?

UniBester avatar Mar 25 '22 01:03 UniBester

Thank you very much for your reply, I suspect that I am having problems making my own dataset, I am downloading the dataset of flowers you provided this morning and I plan to make my own dataset after running the dataset you gave me as a reference first. I'll come back chatter if I don't solve the problem.

zj916716524 avatar Mar 25 '22 04:03 zj916716524

I downloaded the dataset for flowers and created the packet files with "all_img/test" and "all_img/train", and modifications the config/paths_config.py and config/data_config.py

config/paths_config.py

dataset_paths = { 'af_train': '/home/zeng/AGE-main/all_img/train', 'af_valid': '/home/zeng/AGE-main/all_img/test', },

config/data_config.py

from configs import transforms_config from configs.paths_config import dataset_paths DATASETS = { 'af_encode': { 'transforms': transforms_config.EncodeTransforms, 'train_source_root': dataset_paths['af_train'], 'train_target_root': dataset_paths['af_train'], 'valid_source_root': dataset_paths['af_valid'], 'valid_target_root': dataset_paths['af_valid'], }, }

The program has reported an error

Traceback (most recent call last): File "tools/get_class_embedding.py", line 19, in from models.age import AGE File "./models/age.py", line 12, in from models.encoders import psp_encoders File "./models/encoders/psp_encoders.py", line 8, in from models.stylegan2.model import EqualLinear File "./models/stylegan2/model.py", line 7, in from models.stylegan2.op import FusedLeakyReLU, fused_leaky_relu, upfirdn2d File "./models/stylegan2/op/init.py", line 1, in from .fused_act import FusedLeakyReLU, fused_leaky_relu File "./models/stylegan2/op/fused_act.py", line 9, in fused = load( File "/home/zeng/anaconda3/lib/python3.8/site-packages/torch/utils/cpp_extension.py", line 1079, in load return _jit_compile( File "/home/zeng/anaconda3/lib/python3.8/site-packages/torch/utils/cpp_extension.py", line 1317, in _jit_compile return _import_module_from_library(name, build_directory, is_python_module) File "/home/zeng/anaconda3/lib/python3.8/site-packages/torch/utils/cpp_extension.py", line 1699, in _import_module_from_library file, path, description = imp.find_module(module_name, [path]) File "/home/zeng/anaconda3/lib/python3.8/imp.py", line 296, in find_module raise ImportError(_ERR_MSG.format(name), name=name) ImportError: No module named 'fused'

I found that the naming you used in the given dataset is n02085620_25.JPEG_238_24_392_167.jpg, but the data I downloaded from the internet is named image_00033.jpg, did you perform any manipulation in between? Like stitching the original image and the target like zi2zi?

zj916716524 avatar Mar 25 '22 08:03 zj916716524

I guess the program error is because there is something wrong with your environment configuration. You can configure your environment using environment/envrionment.yaml.

As for the naming problem, you should rename you data file in the form of catefgory-id_sample_id.jpg. For example, in n02085620_25.JPEG_238_24_392_167.jpg, "n02085620" is the category id and "25.JPEG_238_24_392_167" is the sample id. They are connected by a "_".

UniBester avatar Mar 25 '22 08:03 UniBester

i down your weight in face dataset,but the opt has no attribution named A_length. the error information is:

Traceback (most recent call last): File "/home/user/.pycharm_helpers/pydev/pydevd.py", line 1483, in _exec pydev_imports.execfile(file, globals, locals) # execute the script File "/home/user/.pycharm_helpers/pydev/_pydev_imps/_pydev_execfile.py", line 18, in execfile exec(compile(contents+"\n", file, 'exec'), glob, loc) File "/home/user/Document/fanbing/AGE/tools/get_class_embedding.py", line 82, in run() File "/home/user/Document/fanbing/AGE/tools/get_class_embedding.py", line 41, in run net = AGE(opts) File "../models/age.py", line 81, in init self.ax = Ax(self.opts.A_length) AttributeError: 'Namespace' object has no attribute 'A_length'

fb-reps avatar Feb 26 '23 09:02 fb-reps