Skip to content
This repository has been archived by the owner on Aug 25, 2024. It is now read-only.

WIP: operations: image: Add new image processing operations #731

Merged
merged 7 commits into from
Jul 2, 2020

Conversation

sakshamarora1
Copy link
Contributor

No description provided.

@lgtm-com
Copy link

lgtm-com bot commented Jun 23, 2020

This pull request introduces 1 alert when merging 57b5034 into 000c440 - view on LGTM.com

new alerts:

  • 1 for Unused import

@sakshamarora1 sakshamarora1 marked this pull request as ready for review June 24, 2020 22:35
Copy link

@johnandersen777 johnandersen777 left a comment

Choose a reason for hiding this comment

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

Can we also change some of those commit messages:

  • operations: image: update setup.py -> operations: image: Add mahotas as dependency

  • operations: image: Add a combine operation (temporarily) -> operations: image: Temporarily add a combine operation

    • Also, if you aren't using this operation within this PR, we shouldn't add it here. Let's add it once we're sure we're using it.
  • df: base: Support default in create_definiton should be a part of the first commit, use fixup (f) to add the changes in that commit to the first commit: https://asciinema.org/a/342828

Also, if your updating resize here breaks the tutorial, then we need to update the tutorial in this PR. Ideally in the same commit as when it would break. I just modified it, so you'll need to rebase in the changes from master git fetch origin && git rebase origin/master

dffml/df/types.py Outdated Show resolved Hide resolved
dffml/df/types.py Outdated Show resolved Hide resolved
@sakshamarora1 sakshamarora1 force-pushed the new_image_op branch 2 times, most recently from f30f584 to 9d0d275 Compare June 26, 2020 09:40
@johnandersen777
Copy link

diff --git a/dffml/util/data.py b/dffml/util/data.py
index fecc142d..2d20dbc6 100644
--- a/dffml/util/data.py
+++ b/dffml/util/data.py
@@ -11,6 +11,7 @@ import types
 import pydoc
 import inspect
 import dataclasses
+import collections
 from functools import wraps
 import pathlib
 from typing import Callable
@@ -215,9 +216,9 @@ def export_value(obj, key, value):
         obj[key] = value.export()
     elif hasattr(value, "_asdict"):
         obj[key] = value._asdict()
-    elif getattr(
-        type(value), "__module__", None
-    ) == "numpy" and inspect.ismethod(getattr(value, "flatten", None)):
+    elif getattr(type(value), "__module__", None) == "numpy" and isinstance(
+        getattr(value, "flatten", None), collections.Callable
+    ):
         obj[key] = tuple(value.flatten())
     elif dataclasses.is_dataclass(value):
         obj[key] = export_dict(**dataclasses.asdict(value))

Seems to produce a formatting issue with pretty


        Key:    two
                                           Record Features
+------------------------------------------------------------------------------------------------------+
|          image          |              0, 0, 0, 0, 0, 0, 0, 0, 0, 0,... (length:235200)              |
+------------------------------------------------------------------------------------------------------+
| calcHist.outputs.result |     28.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0,... (length:512)     |
+------------------------------------------------------------------------------------------------------+
| HuMoments.outputs.result|0.0017639040441027967, 9.804845445470558e-07, 5.200708558150418e-10, 8.626135320076192e-11, 1.600570747118391e
-20, 7.83889684223236e-14, 8.811159537945273e-21,... (length:7)|
+------------------------------------------------------------------------------------------------------+
| Haralick.outputs.result |0.5288095373820749, 3607.66326180678, 0.7728345419503028, 7911.249337317483, 0.7871257954556895, 85.4666372721
9283, 28037.33408746316, 2.5577248244614967, 2.797696097184632, 0.0023745323614962044,... (length:13)|
+------------------------------------------------------------------------------------------------------+
                                                                           Prediction:    Undetermined
DEBUG:dffml.MemoryOrchestratorContext:ctx.outstanding: -1

Also, a commit for fixing no json output on pretty

diff --git a/dffml/cli/list.py b/dffml/cli/list.py
diff --git a/dffml/cli/list.py b/dffml/cli/list.py
index 478047f3..a13f9ec9 100644
--- a/dffml/cli/list.py
+++ b/dffml/cli/list.py
@@ -2,7 +2,7 @@ import pkg_resources

 from ..source.source import BaseSource
 from ..model import Model
-from ..util.cli.cmd import CMD
+from ..util.cli.cmd import CMD, CMDOutputOverride
 from ..util.cli.cmds import SourcesCMD, ListEntrypoint, SourcesCMDConfig
 from ..base import config, field

@@ -29,6 +29,8 @@ class ListRecords(SourcesCMD):
                         print(record)
                     else:
                         yield record
+        if self.pretty:
+            yield CMDOutputOverride


 class ListServices(ListEntrypoint):

Signed-off-by: sakshamarora1 <sakshamarora1001@gmail.com>
Signed-off-by: sakshamarora1 <sakshamarora1001@gmail.com>
…n -pretty is used

Fixes: intel#736

Signed-off-by: sakshamarora1 <sakshamarora1001@gmail.com>
Signed-off-by: sakshamarora1 <sakshamarora1001@gmail.com>
 - Added new flatten operation
 - Updated resize operation to have more parameters
 - Updated the MNIST use case to use flatten and updated resize operation

Signed-off-by: sakshamarora1 <sakshamarora1001@gmail.com>
- calcHist
- HuMoments
- Haralick
- normalize
- convertcolor

Signed-off-by: sakshamarora1 <sakshamarora1001@gmail.com>
Signed-off-by: sakshamarora1 <sakshamarora1001@gmail.com>
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