-
Notifications
You must be signed in to change notification settings - Fork 18.6k
Resolves #105 #107
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
Resolves #105 #107
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please always use a main() function instead of putting things under the if statement.
http://google-styleguide.googlecode.com/svn/trunk/pyguide.html#Main
I personally don't like the idea of having to use argparse instead of python-gflags, which is more flexible and allows one to define flags in multiple modules, and has a C++ counterpart (honestly, I may be biased since I like gflags), thus this change seems unnecessary. Maybe change the code in script/resize_and_crop_images.py to use gflags. @sergeyk @shelhamer Any comments on the choice of commandline flag support? |
My two cents: Python has standard libraries, without a clear reason not to use them, pythonistas will expect to see standard libraries used. "Because it looks more like C++" will not fly for pythonistas. At the end of the day it is about "do you want people to be able to use caffe only from python or not". If the answer is yes, then this change make sense. If the answer is "no this is C++ code, with some python tools", then gflags is fine (since echoes with the C++ part of the codebase). |
(1) python-gflags is pure-python-implemented. (2) python-gflags is fully open-source. (3) caffe is never designed to run "purely on python". It is a C++ library. Decaf serves (more or less) a library under python. (4) Yes, caffe is C++ code with some python tools. Yangqing On Thu, Feb 13, 2014 at 10:04 AM, Rodrigo Benenson <[email protected]
|
I am not particularly fond of the "always use standard libraries" idea. Scientific computation with python will never take off if we stick with standard libraries in the first place (matrices could be a list of list of floats, vector inner products will pythonically be sum(x*y for x, y in zip(vx, vy)), but we all know what follows). This being said, I think a little more explanation why argparse may be bad is in order: The thing I do not like argparse is that you will need to maintain a parser instance under which flags are defined. This makes it difficult when multiple modules define their own flags, and when assembled together form a binary having all these flags naturally combined. python mincepie/demo/wordcount.py --help mincepie.launcher: mincepie.mapreducer: mincepie.mince: gflags: |
Now the reasons are clear @Yangqing :) I raised the issue as a matter of consistency. Since gflags is necessary to compile anyway, @sergeyk if you feel the same, I'll revert the conversion to argparse in |
I'll take care of making requirements.txt a little more flexible. Plus, I think it is potentially a trap to have separate requirements.txt for the wrapper and the scripts and we should perhaps keep a single one. |
@Yangqing That said, python-gflags looks un-pythonic and unmaintained to me. @shelhamer Although you can close the issue to drop the py-gflags dependency, I don't see a need to revert the detector.py changes right now. If we ever have to share flags defined in that module with another module, then we can go back to gflags -- or find a better way. |
I agree. Having flag definitions we are used to in individual demo codes python-gflags is quite un-pythonic but probably won't be buggy given the Yangqing On Thu, Feb 13, 2014 at 1:30 PM, Sergey Karayev [email protected]:
|
Hi, I've been lurking for a bit, but haven't had the time to contribute much in the way of discussion; talked to Yangqing and Evan about eigen-boost branch a while ago. Maybe it's too much effort for too little pay off at this point, but docopt could be a good solution. It's familiar (at least the cli syntax), pythonic, and could help enforce documentation of command line options. You write out your help message in a formal syntax and it automatically parses everything for you. Michael |
Synchronized BN layer
script/resize_and_crop_images.py uses gflags to pass the arguments to mincepie which depends on gflags. For compatibility with mincepie, it will not be changed.
Add shebang at the beginning of python files to run them directly rather than by "python caffe/*.py".
Patch python/caffe/pycaffe.cpp per @longjon's comment in #44.
pip cannot find h5py 2.2.0.
Fixes issue: #105