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

Use fake (generated) images for faker opposed to real people #465

Closed
dmadisetti opened this issue Feb 10, 2022 · 26 comments · Fixed by #3126
Closed

Use fake (generated) images for faker opposed to real people #465

dmadisetti opened this issue Feb 10, 2022 · 26 comments · Fixed by #3126
Assignees
Labels
c: feature Request for new feature m: image Something is referring to the image module p: 1-normal Nothing urgent
Milestone

Comments

@dmadisetti
Copy link

Describe the bug

It looks like the faker images are just using some scraped profile list from ages back, and stored on a cloudflare bucket
https://cloudflare-ipfs.com/ipfs/Qmd3W5DuhgHirLHGVixi6V76LhCkZUz6pnFt5AJBiyvHye/avatar/<number>.jpg

Opposed to using real images (I recognized one of the people lol), faker should maybe use fake images.
Some ideas are

I would suggest just overwriting the cloudflare images (that way you have backwards compatibility, and you are no longer exposing the images). For that, you need to find the maintainer of the bucket (and also maybe build in some redundancy? I think this community is probably familiar with maverick devs), which looks like bogus, so I opened an issue there too.

Marked as a bug, because you should fix this (even though you are not directly responsible for the images)- I don't think it's responsible to be posting pictures of 1250 random people without their consent.

Reproduction

Additional Info

Tracking down the source of the initial images see:

@ST-DDT
Copy link
Member

ST-DDT commented Feb 10, 2022

IMO the avatar should return an actual/fake avatar instead of a persons face.
For persons faces we should add a separate api, that only returns fake faces.

@dmadisetti dmadisetti changed the title User fake (generated) images for faker opposed to real people Use fake (generated) images for faker opposed to real people Feb 10, 2022
@dmadisetti
Copy link
Author

You could potentially use identicons (which is what github uses) which is actually a hash based on username: https://github.com/stewartlord/identicon.js

The images could be generated from your list of fake names. I'd count this as a bonus since it could potentially allow for easier debugging (Alice/Bob/Camerons are always going to be associated with the same image).

@prisis
Copy link
Contributor

prisis commented Feb 10, 2022

We have some cases where real face images are needed, so a option to choose what type of avatar you want would be the best option

@dmadisetti
Copy link
Author

Just an update from the guy on the README
twitter com_messages_15894801-275195245

@Shinigami92
Copy link
Member

We have some cases where real face images are needed, so a option to choose what type of avatar you want would be the best option

Or at least provide an additional api, so we have image.avatar({ type }) and image.face(...) ...

@dmadisetti
Copy link
Author

While this is an issue, I'm going to advocate for user images to be taken from across the race / gender spectrum. The current avatars are primarily white and male

@ejcheng
Copy link
Member

ejcheng commented Feb 21, 2022

@Shinigami92 Should this be v6.2 or v7? I'm leaning towards v7, but I'll let you make the final decision

@ST-DDT
Copy link
Member

ST-DDT commented Feb 21, 2022

I think we should not tag this for 6.2 as it is a major change in behavior.
As for v7, I would like to use v7.0 mainly to do some cleanup and refactoring/renaming so I'm not sure whether this would fit there.
We should give this its own feature version to give it its due attention, but I'm not sure when we will tackle this exactly.
Maybe we can create a Future milestone for that, which would serve as a "Pull Backlog" for us and "Open for contributions" for others.
What do you think?

@ejcheng
Copy link
Member

ejcheng commented Feb 21, 2022

I think we should not tag this for 6.2 as it is a major change in behavior. As for v7, I would like to use v7.0 mainly to do some cleanup and refactoring/renaming so I'm not sure whether this would fit there. We should give this its own feature version to give it its due attention, but I'm not sure when we will tackle this exactly. Maybe we can create a Future milestone for that, which would serve as a "Pull Backlog" for us and "Open for contributions" for others. What do you think?

Yeah, I think the Future milestone is the way to go here. We should make one.

@matthewmayer
Copy link
Contributor

matthewmayer commented Sep 14, 2024

I think a fairly easy way to do this while nsuring a diverse set of images would be:

  1. Generate a list of prompts using something like
faker.helpers.fake(`profile picture of a {{number.int({"min":18, "max":80})}}-year-old {{person.sex}} from {{location.country}}`);
  1. Feed the prompts into a AI image generator - eg Stable Diffusion or Adobe Firefly and generate 4 images at a time around 512x512
  2. Manually pick the best image from each set
  3. Name these as 1...100.jpg and dump in a Github repo under faker-js org
  4. Update the avatar methods to point at these images via a CDN

This should only be an hour or two's work.

@matthewmayer
Copy link
Contributor

I tried generating 100 images with Stable Diffusion 3 (50 male, 50 female)

They can be accessed like this:
https://cdn.jsdelivr.net/gh/matthewmayer/sd3-avatars/generic/1.jpg
up to
https://cdn.jsdelivr.net/gh/matthewmayer/sd3-avatars/generic/100.jpg

Code i used to generate is at https://github.com/matthewmayer/sd3-avatars

@ST-DDT
Copy link
Member

ST-DDT commented Sep 17, 2024

Looks like a good solution. We have to check the TOS though.

@dmadisetti
Copy link
Author

Nice! Great starting point. Didn't exactly hit the mark on diversity though. Maybe 4-5 ethnically ambiguous people in the males + the last 2 that looked intentional (one Black guy and one South Asian)

Might seem overbearing; but from a product perspective- why limit your market

@matthewmayer
Copy link
Contributor

Agreed its too white at the moment.

image

@matthewmayer
Copy link
Contributor

matthewmayer commented Sep 17, 2024

Made a new branch https://github.com/matthewmayer/sd3-avatars/tree/country-prompt where i append a random from {{location.country}} to each prompt
e.g. "profile picture of a 67-year-old woman from India"
https://cdn.jsdelivr.net/gh/matthewmayer/sd3-avatars@country-prompt/generic/74.jpg

These folks seem more diverse.

@matthewmayer
Copy link
Contributor

Screenshot 2024-09-17 at 22 14 29

@dmadisetti
Copy link
Author

Awesome! Good job Stable diffusion for not being offensively stereotypical. LGTM, including the guy that's too cool for a shirt in a profile picture

@ST-DDT
Copy link
Member

ST-DDT commented Sep 17, 2024

If we use jsdelivr, we have to add a link to their TOS to each method returing their links:
https://www.jsdelivr.com/terms

@matthewmayer
Copy link
Contributor

Would we want to make this a new method like avatarAI() and then have avatar() pick between avatarAI() and avatarGithub()?

@Shinigami92
Copy link
Member

Would we want to make this a new method like avatarAI() and then have avatar() pick between avatarAI() and avatarGithub()?

We could also think about to directly go to how these images are more target to -> person module.
But I'm still a bit unsure if we should call it avatar, pfp, profilePicture, photo, image, or whatever.
Sadly I'm busy the next few days attending a conference, so cant provide feedback for around 3 days. 🙁 👋

@ST-DDT
Copy link
Member

ST-DDT commented Sep 18, 2024

I'm not sure whether I would name it avatar.
IMO these are portraits -> faker.image.portrait().

Or should portraits have a blank background?
What are your requirements for portraits?
Do you just need a portrait, or do you need them in buisness or "passports" contexts? Or all of these?

We could still add them as a possibility to avatar.

And add a link to the method in the person module's description.

@matthewmayer
Copy link
Contributor

I think avatar is fairly commonly used in software development as a synonym for a typically user-set "profile picture" etc so i don't mind the current name. faker.image.portrait() at first glance i'd think it would give me a portrait shaped image (rather than landscape).

@matthewmayer
Copy link
Contributor

we should definitely cross-reference in the person module overview like we do for email addresses and phone numbers

image

@Shinigami92
Copy link
Member

Shinigami92 commented Sep 18, 2024

I'm not sure whether I would name it avatar.

IMO these are portraits -> faker.image.portrait().

Or should portraits have a blank background?

What are your requirements for portraits?

Do you just need a portrait, or do you need them in buisness or "passports" contexts? Or all of these?

We could still add them as a possibility to avatar.

And add a link to the method in the person module's description.

portraits! That was the word I missed in my head.

I (/ my previous Company) need them like the images were generated by @matthewmayer. More or less frontal/orthogonal portraits of human faces. Detecting landmarks, analyzing ethicality, age and gender.
Normal in or outside realworld backgrounds are welcome. So no ID card backgrounds required.

The company has tools on their own to extract the human out of the image and therefore remove the background.

@ST-DDT ST-DDT added p: 1-normal Nothing urgent m: image Something is referring to the image module labels Oct 20, 2024
@ST-DDT ST-DDT modified the milestones: vFuture, v9.x Oct 20, 2024
@matthewmayer
Copy link
Contributor

Blocked by #3131 next step is to set up the assets repo

@ST-DDT
Copy link
Member

ST-DDT commented Feb 10, 2025

We now use AI generated images instead.

The feature will be available in the next update:

https://next.fakerjs.dev/api/image.html#personportrait

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
c: feature Request for new feature m: image Something is referring to the image module p: 1-normal Nothing urgent
Projects
No open projects
Status: Todo
Development

Successfully merging a pull request may close this issue.

6 participants