Open TheGincgoGreco opened 3 years ago
Thank you so much for the kudos and the detailed suggestions Greg! Would you be interested in trying to code this up via a pull request? I'm afraid I currently do not have the time to implement this on my own, but the features would certainly improve the package.
Hallo Carsten,
Hut ab vor dir für dein fantastisches
imgrec
Paket! 💯 While I am only a novice programmer, I can say this package is by far the most robust and thorough interface I have encountered between R and Vision API.I am currently working on a project that highlights the utility of (and my need for) a couple more features, to make
imgrec
truly comprehensive and extensible. Kindly overlook the amateur nature of my code below; naturally, I don't presume to submit it as a formal suggestion, let alone a pull request.1. Distinct
max_res
for Each FeatureWhile Vision presents some hurdles for scalability, I would love to take advantage of its flexibility to obtain annotations in different volumes for different features, as seen in Google's demo for Vision API:
Would it be possible to generalize
imgrec::get_annotations
, such thatmax_res
is a numeric vector containing onemaxResults
value for each selected feature?I suppose this would require a modification to
build_features
:Perhaps this could be further modified to accommodate
Inf
for practically unlimited volumes of responses.2. Authorization via Service Account
Some R interfaces with the Google Cloud Platform (GCP), permit API authorization via a service account, whose credentials are downloaded in JSON format. For example, the
bigrquery
package hasThis permits convenient parameterization: one can codelessly update the credentials by simply overwriting the JSON file (stored locally at
path
). Furthermore, service accounts can limit activity by the R client to only those scopes assigned by an authorized user within GCP.Would a
imgrec::gvision_auth
function be possible, with analogous parameters to load local credential files for GCP service accounts?3. Batch Size as a Parameter
In my own project, I managed to cobble together a few functions, to (reversibly) mutate
.imgrec$img_per_req
in theimgrec
environment:⋮
Yet while I need such functionality for my project, I am extremely nervous about tampering with the environments of packages built by programmers far more experienced than me. Could you possibly add a
batch_size
parameter toimgrec::get_annotations
?I suppose it would require a modification to
build_chunks
.To clarify, I do understand that Vision caps batches at 16 images apiece, and that smaller batch sizes are less efficient under quotas on Vision calls. Until the Vision developers can make larger batch sizes more efficient, I doubt this third feature would have much significance. However, when those developers eventually do so, the
batch_size
parameter would allowimgrec
users to independently adapt their code, without waiting for those Vision updates to be reflected in theimgrec
parameters.Anyway, thank you for your consideration!
Best Regards — Greg