Closed Drewsif closed 9 years ago
Thank you for suggestion.
This change cannot be marged. Because, the result has changed although speed is quick by this change. I think that resizing should be performed by the side which uses nude.py. see #3
I merge it if you can send a patch only in a part of option parsing and typo.
Regards
So I moved the resize code to its own function in the Nude class. I put a command line option to call this function for you if you want.
This way it won't effect the original image by default and a user can choose to do it if they want the speed boost. Rather then having to make the user research the resizing topic (like I did) it can be built into the class for them. Does that work for you?
I now also added a test script to test true positive and false positive rates. In the command line runs it now also uses multiprocessing to finish a lot faster when there is more then one file.
I had to delete it and put it under if __name__ == "__main__":
so that it would work correctly on a windows. Everything main()
did is now under if __name__ == "__main__":
.
Again the only reason I had to do this was so the code worked correct on windows which I found here https://docs.python.org/2/library/multiprocessing.html#multiprocessing-programming
I merged your newest code in and I moved multiprocessing support so that the CLI user needs to ask for it.
The print was not needed and removed. Good catch
Style changes made
Results:
$ time ./nude.py examples/images/* -t 4
examples/images/damita.jpg False
examples/images/damita2.jpg False
examples/images/test6.jpg False
examples/images/test2.jpg True
real 0m3.439s
user 0m8.844s
sys 0m0.855s
$ time ./nude.py examples/images/*
examples/images/damita.jpg False
examples/images/damita2.jpg False
examples/images/test2.jpg True
examples/images/test6.jpg False
real 0m8.102s
user 0m7.409s
sys 0m0.592s
@Drewsif Thanks, merged.
I added automatic image resize so that it can run on really large images in a timely manner. I also fixed up the command line version so it uses argparse and has some prettier output.