Skip to content
This repository has been archived by the owner on Jun 3, 2020. It is now read-only.

QDeepLandia v1.0.0 #1

Open
wants to merge 11 commits into
base: master
Choose a base branch
from
Open

QDeepLandia v1.0.0 #1

wants to merge 11 commits into from

Conversation

SebastienPeillet
Copy link

First operative version of qdeeplandia.

Long story short :

  • qdeeplandia.py contains the plugin main class QDeeplandiaPlugin that :

    • defines menu and toolbar
    • initializes qdeeplandia processing toolbox
    • initializes internalization
    • handle gui interaction (user click, enable/disable button during task etc)
  • gui folder stores pop-up windows; so at the moment there is only the windows that ask the number of label handled by the loaded model.

  • processing_provider is the folder relative to the processing toolbox, it contains :

    • provider.py, the qdeeplandia processing tool provider
    • datagen.py, a processing tool to generate tiles according to the loaded model; for now it used a subprocess deepo datagen etc etc, it could be changed to use API in the future
    • inference.py, a processing tool to do inference on the current raster layer, this tool use the previous one to generate the tiles.
  • inferenceTask.py : Inference tool has been wrapped in a QgsTask to avoid to freeze QGIS during the inference


Installation

I didn't really care about the installation procedure. But to explain how it works for me :

  • qdeeplandia is installed in my qgis plugin folder
  • I added deeposlandia in qdeeplandia folder (symbolic link) to do relative import
  • before launching Qgis, I source specific PYTHONPATH (because PyQt5 installed with deeposlandia doesn't pleased my qgis installation...) and PATH to add deeposlandia bin folder.

futhermore there is a config.ini in the qdeeplandia repository, which is needed to initialize deeposlandia, but I believe that it is not used after initialization.

@SebastienPeillet SebastienPeillet changed the title Dev QDeepLandia v1.0.0 May 22, 2020
@delhomer
Copy link
Contributor

Small comment about the versioning: instead of a 1.0.0, I would prefer a 0.1.0, denoting we are still in a early stage of the project.

Copy link
Contributor

@delhomer delhomer left a comment

Choose a reason for hiding this comment

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

Fantastic work, thanks @SebastienPeillet !

I have some minor style comments, as well as a pair of remarks relative to the get_trained_model function, from the deeposlandia API, that could be updated here.

I point out some additional points, however we will address them in further PRs; I plan to write some related issues so as to be meticulous.

config.ini Outdated Show resolved Hide resolved
qdeeplandia.py Outdated Show resolved Hide resolved
qdeeplandia.py Outdated Show resolved Hide resolved
locale_path = os.path.join(
os.path.dirname(__file__),
'i18n',
'thyrsis_{}.qm'.format(locale))
Copy link
Contributor

Choose a reason for hiding this comment

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

Is this file committed?

self.initProcessing()

self.toolbar = QToolBar(tr("QDeepLandia_toolbar"))
self.toolbar.setObjectName("QDeepLandia_toolbar")
Copy link
Contributor

Choose a reason for hiding this comment

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

Not sure to understand the difference with the previous line, do you really want both these lines?



class DatagenQDeepLandiaProcessingAlgorithm(QgsProcessingAlgorithm):
"""
Copy link
Contributor

Choose a reason for hiding this comment

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

Docstrings welcomed! :)

processing_provider/datagen.py Outdated Show resolved Hide resolved

path=''
for i in [dest_path, dataset, 'input','testing','images']:
path = os.path.join(path, i)
Copy link
Contributor

Choose a reason for hiding this comment

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

os.path does not seem very practical in this use case... Maybe we should consider pathlib.Path (Python3) in the future.

shutil.rmtree(os.path.join(dest_path, dataset, 'preprocessed', str(shape)))

cmd = ['deepo', 'datagen', '-D', dataset, '-s', str(shape), '-P', dest_path, '-T', '1']
subprocess.run(cmd)
Copy link
Contributor

Choose a reason for hiding this comment

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

I'm kind of puzzled with the call to subprocess. I'm sure we could use the deeposlandia API; let's say it's OK there, however it deserves a special issue.

dataset = os.path.basename(os.path.abspath(os.path.join(os.path.dirname(model_path), '..', '..', '..')))
image_size = os.path.splitext(os.path.basename(model_path))[0].split('-')[-1]
try :
model = get_trained_model(datapath, dataset, int(image_size), int(nb_labels))
Copy link
Contributor

Choose a reason for hiding this comment

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

Same remark as in the datagen.py module.

@delhomer delhomer force-pushed the dev branch 2 times, most recently from 5806c54 to 0e5a51a Compare May 28, 2020 08:55
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants