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

Add a new command to install models #189

Merged
merged 11 commits into from Nov 24, 2019
Merged

Conversation

matiasdelellis
Copy link
Owner

Ok, The app store has a limit of 20Mb and our proposed application with the models weighs 27.8 MB.

Well, If we intended to support various models, at some point we had to do something like this.

This is not so happy either, because when you download the files in the application folder we change your checksum, and we will have reports that there are changed files.

Simil that:
imagen

I think that at this stage of testing, this is acceptable, but we must place the models in a more appropriate directory.

@matiasdelellis
Copy link
Owner Author

matiasdelellis commented Nov 24, 2019

TODO:

  • Update docs.
  • Change CheckrequerimentsTask to warn this ..
  • Update Makefile to ignore the models on app store...

use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;

class InstallModelsCommand extends Command {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

so, I was wondering... can we make this a bit generic. We already discussed this in the form of ./occ face:recommend_memory (here. Can you name this command, someting like ./occ face:setup or ./occ face:prepare or ./occ face:first_time_setup or ./occ face:initialize.... point is, we can use this same command later, not just for downloading models, but this is a place we can tell people "hey, your recommended memory is not high" or "hey, DLib does not exist", or "hey, PDLib cannot be initialized"... instead of having 2-3-5 commands for this, why not make it one? At this moment, it can contain only models, but in the future, we can bundle all various things in here. First next step to merge in this command would be check requirements

Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK.. ./occ face:setup
Now without an argument, but then ./occ face:setup model 2, ./occ face:setup memory can be added. I did not like setup, but it is the most generic, and can be consistent with the arguments.

$this->logger = $output;

$this->tempFolder = $this->tempManager->getTemporaryFolder('/facerecognition/');
$this->modelsFolder = $this->appManager->getAppPath('facerecognition') . '/vendor/models/1/';
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

so....how this works? If now are our models not part of our install/bundle/zip and they reside inside our app, what happens when users upgrade our app? models do disappear and user need to execute ./occ face:install_models again? If this is not true, ignore my comment. But if this is true, this would be real pain for users. However, I am not sure what other location we can have at our disposal to place models there?

Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

so....how this works? If now are our models not part of our install/bundle/zip and they reside inside our app, what happens when users upgrade our app? models do disappear and user need to execute ./occ face:install_models again?

Wow.. God point..

Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

However, I am not sure what other location we can have at our disposal to place models there?

appdata_INSTANCE_ID seems a good place.. There are saved the preview, avatars, richdocuments templates, deck images, etc. etc.

Copy link
Collaborator

@stalker314314 stalker314314 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

waiting for my comments

@matiasdelellis
Copy link
Owner Author

Ok.. The last commit doesn't work and I don't know why ... 😢

Also change the model folder to the appdata._instanceId/facrerecogntion/models/
@stalker314314, If you see anything let me know. I don't know where to look anymore. 😞

The error was:

[matias@nube nextcloud]$ sudo -u apache php occ -vvv face:setup
[sudo] password for matias: 
An unhandled exception has been thrown:
ArgumentCountError: Too few arguments to function OCA\FaceRecognition\Command\BackgroundCommand::__construct(), 0 passed in /var/www/html/nextcloud/lib/private/Console/Application.php on line 222 and exactly 2 expected in /var/www/html/nextcloud/apps/facerecognition/lib/Command/BackgroundCommand.php:51
Stack trace:
#0 /var/www/html/nextcloud/lib/private/Console/Application.php(222): OCA\FaceRecognition\Command\BackgroundCommand->__construct()
#1 /var/www/html/nextcloud/lib/private/Console/Application.php(134): OC\Console\Application->loadCommandsFromInfoXml(Array)
#2 /var/www/html/nextcloud/console.php(96): OC\Console\Application->loadCommands(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#3 /var/www/html/nextcloud/occ(11): require_once('/var/www/html/n...')

@stalker314314
Copy link
Collaborator

Did 'doh' commit (8db816c) solved problem, or I should try it locally?:)

@matiasdelellis
Copy link
Owner Author

Did 'doh' commit (8db816c) solved problem,

No.. 😞

or I should try it locally?:)

Yes please.. At least look at all the diff to see if you notice anything ..

@matiasdelellis
Copy link
Owner Author

@stalker314314
Now yes.. Although it does not work, with the last commit fix this problem that drove me crazy.!

@matiasdelellis
Copy link
Owner Author

Now it seems to work. 😄
Please, I need a real test ... and I'm sorry, but the tests again leave them pending to you.. 😞

@@ -54,6 +54,7 @@ before_script:
- cd apps/$APP_NAME

script:
- ./occ face:setup
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess it really doesn't matter, but isn't it more logical to have make test and only after face:setup?

Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess it really doesn't matter, but isn't it more logical to have make test and only after face:setup?

I modified it in case there was any test that depended on the models. Change it along with the necessary tests. 😉

@stalker314314
Copy link
Collaborator

Everything mostly works, other than stuff I mentioned:) I still cannot visit index.php/settings/admin/facerecognition, so I can try again when that is fixed. But mostly - it does works nicely!

@matiasdelellis
Copy link
Owner Author

Everything mostly works, other than stuff I mentioned:) I still cannot visit index.php/settings/admin/facerecognition, so I can try again when that is fixed. But mostly - it does works nicely!

All done.
After publishing I want to do some cleaning and code reorganization, but for what we need now I think it's fine ..

@matiasdelellis matiasdelellis merged commit b99f6a6 into master Nov 24, 2019
@matiasdelellis matiasdelellis deleted the install-models-command branch November 25, 2019 00:25
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

Successfully merging this pull request may close these issues.

None yet

2 participants