Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

can not align facescrub #9

Closed
delveintodetail opened this issue Jan 24, 2018 · 16 comments
Closed

can not align facescrub #9

delveintodetail opened this issue Jan 24, 2018 · 16 comments

Comments

@delveintodetail
Copy link

python align_facescrub.py --input-dir ~/face/megaface/facescrub/ --output-dir ./facescrub_align
Martin Henderson/Martin Henderson_40499
Rebecca Budig/Rebecca Budig_10788
Pamela Anderson/Pamela Anderson_2367
valid keys 3530
Creating networks and loading parameters

AttributeError: 'EasyDict' object has no attribute 'landmark'

@delveintodetail
Copy link
Author

more information, I successfully run align_megaface.py but cannot run align_facescrub.py.

@delveintodetail
Copy link
Author

2018-01-24 16:04:26.818465: I tensorflow/core/common_runtime/gpu/gpu_device.cc:976] DMA: 0
2018-01-24 16:04:26.818471: I tensorflow/core/common_runtime/gpu/gpu_device.cc:986] 0: Y
2018-01-24 16:04:26.818480: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1045] Creating TensorFlow device (/gpu:0) -> (device: 0, name: TITAN X (Pascal), pci bus id: 0000:02:00.0)
Processing 0, ([0 0 0 0 0])
Traceback (most recent call last):
File "align_facescrub.py", line 274, in
main(parse_arguments(sys.argv[1:]))
File "align_facescrub.py", line 169, in main
if fimage.landmark is not None:
AttributeError: 'EasyDict' object has no attribute 'landmark'

@nttstar
Copy link
Collaborator

nttstar commented Jan 24, 2018

Hi delveintodetail, plz update the repo and try again.
Align facescrub is a little bit tricky, you may need to put some additional files into the 'input dir'. You can review the code firstly, the files we need is obvious and hard-coded.
Based on this fact, we will consider to release aligned facescrub images directly if there's no legal problem.

@delveintodetail
Copy link
Author

I have put facescrub_actors.xt, facescrub_actresses.txt and facescrub_upcropped_feature_list.json in the 'input dir'. I upgrade the code, still the same problem...

@nttstar
Copy link
Collaborator

nttstar commented Jan 24, 2018

Check it again now.

@delveintodetail
Copy link
Author

/Face_scrub/facescrub/Adrienne Frantz/Adrienne Frantz_27768.jpg: cannot identify image file '/Face_scrub/facescrub/Adrienne Frantz/Adrienne Frantz_27768.jpg'

OpenCV Error: Unspecified error (could not find a writer for the specified extension) in imwrite_, file /opt/conda/conda-bld/opencv_1491943414359/work/opencv-3.1.0/modules/imgcodecs/src/loadsave.cpp, line 459
Traceback (most recent call last):
File "align_facescrub.py", line 273, in
main(parse_arguments(sys.argv[1:]))
File "align_facescrub.py", line 256, in main
cv2.imwrite(target_file, bgr)

@delveintodetail
Copy link
Author

should the facescrub be the original uncropped or the provide cropped directory??? if it is the cropped facescrub director, the result looks like
default

@nttstar
Copy link
Collaborator

nttstar commented Jan 24, 2018

You need to use uncropped images to align.
By the way, you can detect landmarks by any public available MTCNN and then do similarity transform to 112x112. The result should be the same.

@delveintodetail
Copy link
Author

delveintodetail commented Jan 24, 2018

I still cannot obtain good detection results with your code for uncropped images (align_facescrub.py).
in your code:
if fimage.landmark is not None:

if warped is None and fimage.bbox is not None:

but for the uncrossed images, there are no landmark and bbox, can you pls show your detected code?
if possible, can you provide the code and run script???

@delveintodetail
Copy link
Author

delveintodetail commented Jan 24, 2018

def get_dataset_facescrub(input_dir):
  ret = []
  label = 0
  person_names = []
  for person_name in os.listdir(input_dir):
    person_names.append(person_name)
  person_names = sorted(person_names)
  for person_name in person_names:
    subdir = os.path.join(input_dir, person_name)
    if not os.path.isdir(subdir):
      continue
    for _img in os.listdir(subdir):
      fimage = edict()
      fimage.id = os.path.join(person_name, _img)
      fimage.classname = str(label)
      fimage.image_path = os.path.join(subdir, _img)
      fimage.landmark = None
      fimage.bbox = None
      ret.append(fimage)
    label += 1
  return ret

bbox and lardmark are both none, then in your code, so although we input the uncropped images, the code in align_facescrub.py will not use face_detection.face_detection(). I am confused how you do this???
Thanks for your information in advance.

@delveintodetail
Copy link
Author

can you pls show your detected face images???

@nttstar
Copy link
Collaborator

nttstar commented Jan 24, 2018

I remember facescrub has its own defined bounding-box. You can parse it and add them in face_image.py. Recently we just use another piece of mtcnn code to align the facescrub images.

To make our result reproducible, we may put the aligned facescrub images in our repo soon.

@nttstar
Copy link
Collaborator

nttstar commented Jan 25, 2018

@delveintodetail I just fixed the issue of align_facescrub.py, plz try it again.

@nttstar
Copy link
Collaborator

nttstar commented Jan 25, 2018

and the output file name follows the template of aligned facescrub set(firstname_lastname.png)

@delveintodetail
Copy link
Author

megafaces/Face_scrub/facescrub/Harry Connick Jr./Harry Connick Jr._22911
Traceback (most recent call last):
File "align_facescrub.py", line 288, in
main(parse_arguments(sys.argv[1:]))
File "align_facescrub.py", line 156, in main
img_id = int(body)
ValueError: invalid literal for int() with base 10: 'Harry Connick Jr'

@nttstar
Copy link
Collaborator

nttstar commented Jan 25, 2018

file name is Harry Connick Jr._22911.jpg on my disk, try to fix it by yourself.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants