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

Face flag doesnt seem to work #84

Closed
kartikwar opened this issue Oct 11, 2022 · 9 comments
Closed

Face flag doesnt seem to work #84

kartikwar opened this issue Oct 11, 2022 · 9 comments

Comments

@kartikwar
Copy link

I am using the face flag to prevent faces from getting distorted (as mentioned in the documentation). But there seems to be no difference in output with/without this flag. Am I doing something wrong?

This is the command I used

go run github.com/esimov/caire/cmd/caire@latest -in /home/kartik/example.jpg -out output.jpg -face=1 -perc=1 -width=30

Attaching the output as well

output0

@esimov
Copy link
Owner

esimov commented Oct 11, 2022

The reason is the following: when you are running the CLI with face detection enabled it embeds the facefinder cascade file on-the-fly without to require the cascade file as a standalone flag argument. You can check this one below in the process.go file :

//go:embed data/facefinder

Now, because you are downloading and running the binary file at the same time the data folder is missing and obviously also the facefinder cascade file. The strange thing is that it should have thrown an error that the cascade file is missing or cannot be unpacked like in the line 420:

caire/process.go

Lines 418 to 421 in 1cd0863

p.PigoFaceDetector, err = p.PigoFaceDetector.Unpack(cascadeFile)
if err != nil {
return fmt.Errorf("error unpacking the cascade file: %v", err)
}

I will look into it.

@kartikwar
Copy link
Author

Thanks for your reply @esimov. I don't have any experience with go prior to this. Can you please tell me how can this be fixed? Awaiting your reply. Thanks in advance

@esimov
Copy link
Owner

esimov commented Oct 12, 2022

If you need a quick resolution, then the most straightforward way is to download the project and run the application inside the root directory where it has been installed. I'm telling this, because I have just realized that in situations like this, when you are running the application once it has been downloaded the embedding might not work just out of the box.

I will try modify the code in such a way that in case the embedded file is not accessible to ask for the cascade file.

@kartikwar
Copy link
Author

Whats the command to run it locally? Currently I am using go run github.com/esimov/caire/cmd/caire@latest

@esimov
Copy link
Owner

esimov commented Oct 12, 2022

It's stated on the Readme file: go install github.com/esimov/caire/cmd/caire@latest

@kartikwar
Copy link
Author

OK but this would run from source right. I want to run locally from root folder like you mentioned. I am guessing the command you shared would fetch from github and run

@esimov
Copy link
Owner

esimov commented Oct 12, 2022

I am guessing the command you shared would fetch from github.

Exactly, it will fetch from the Github and also will create the executable. See the documentation: https://go.dev/ref/mod#go-install

Meantime I just wanted to make sure that building locally will embed the cascade file correctly, and it does. So if you build the main go file from cmd/caire running the go build main.go command the face detection will work. I need to figure out why the embedding is not working when you are running directly with go run command.

@kartikwar
Copy link
Author

This is working locally by using the go run command as you mentioned. Closing this issue, as this works for me. Also, you might want to update the instructions to run it from local only.

@esimov
Copy link
Owner

esimov commented Oct 13, 2022

$ go install github.com/esimov/caire/cmd/caire@latest should install the package along with its dependencies into the $GOPATH/bin folder, exactly as it's described in the README file: https://github.com/esimov/caire#install

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