From 62625d24c73c130a586365810616c81e583931e5 Mon Sep 17 00:00:00 2001 From: Gorkem Polat <110481017+Gorkem-Encord@users.noreply.github.com> Date: Fri, 12 Aug 2022 12:24:38 +0300 Subject: [PATCH 1/5] add link to the detailed installation wiki page --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index c85187c15..00cd31212 100644 --- a/README.md +++ b/README.md @@ -8,7 +8,7 @@ To install dependencies, run ```shell > poetry install ``` - +If you encounter any error, please check [here](!https://github.com/encord-team/data-quality-pocs/wiki/Installation) ## Configuration Before you start, you should copy the `conf/config_example.yaml` to `conf/config.yaml` and update the settings to match your local system / preferences. From 0589ba237697d37a1d7e18844e344f304d4212b9 Mon Sep 17 00:00:00 2001 From: Gorkem Polat <110481017+Gorkem-Encord@users.noreply.github.com> Date: Fri, 12 Aug 2022 12:25:26 +0300 Subject: [PATCH 2/5] fix installation page link --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 00cd31212..c5ba4a55c 100644 --- a/README.md +++ b/README.md @@ -8,7 +8,7 @@ To install dependencies, run ```shell > poetry install ``` -If you encounter any error, please check [here](!https://github.com/encord-team/data-quality-pocs/wiki/Installation) +If you encounter any error, please check [here](https://github.com/encord-team/data-quality-pocs/wiki/Installation) ## Configuration Before you start, you should copy the `conf/config_example.yaml` to `conf/config.yaml` and update the settings to match your local system / preferences. From 8ab6eb173516bf76ddaaceb0f367955e65228628 Mon Sep 17 00:00:00 2001 From: Gorkem Polat <110481017+Gorkem-Encord@users.noreply.github.com> Date: Fri, 12 Aug 2022 12:26:30 +0300 Subject: [PATCH 3/5] fix typo --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index c5ba4a55c..d7c39a4ef 100644 --- a/README.md +++ b/README.md @@ -8,7 +8,7 @@ To install dependencies, run ```shell > poetry install ``` -If you encounter any error, please check [here](https://github.com/encord-team/data-quality-pocs/wiki/Installation) +If you encounter any error, please check [here](https://github.com/encord-team/data-quality-pocs/wiki/Installation). ## Configuration Before you start, you should copy the `conf/config_example.yaml` to `conf/config.yaml` and update the settings to match your local system / preferences. From 0ab7e1090aab5e5ec57ac8a33a96a57d5dcb395e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Frederik=20Hvilsh=C3=B8j?= Date: Fri, 12 Aug 2022 11:28:38 +0200 Subject: [PATCH 4/5] Compute all image features. --- pocs/img_features.py | 40 ++++++++++++++++++++++++++-------------- 1 file changed, 26 insertions(+), 14 deletions(-) diff --git a/pocs/img_features.py b/pocs/img_features.py index eef882354..1b3c9c9cd 100644 --- a/pocs/img_features.py +++ b/pocs/img_features.py @@ -42,10 +42,21 @@ def rank_by_blur(image): return 1 - cv2.Laplacian(image, cv2.CV_64F).var() +options = { + "contrast": (rank_by_contrast, "Contrast"), + "green": (rank_by_green, "Greenness"), + "red": (rank_by_red, "Redness"), + "blue": (rank_by_blue, "Blueness"), + "brightness": (rank_by_brightness, "Brightness"), + "sharpness": (rank_by_sharpness, "Sharpness"), + "blurriness": (rank_by_blur, "Blurriness"), +} + + @hydra.main(version_base=None, config_path="../conf", config_name="config") def main(cfg: DictConfig): cache_dir, project = fetch_project_info(cfg) - iterator = DatasetIterator(project, cache_dir, use_images=True, subset_size=100) + iterator = DatasetIterator(project, cache_dir, use_images=True, subset_size=-1) # When you log stuff, this will be stored in the `pocs/outputs` directory. @@ -53,23 +64,24 @@ def main(cfg: DictConfig): # You can build/load databases of embeddings, compute statistics etc, # ... - with CSVIndexWriter(cache_dir, iterator, prefix="brightness-indexer") as writer: - for data_unit, img_pth in tqdm(iterator.iterate(), desc="Iterating data units", total=len(iterator)): - key = iterator.get_identifier() + for rank_fn, name in options.values(): + with CSVIndexWriter(cache_dir, iterator, prefix=f"{name}-indexer") as writer: + for data_unit, img_pth in tqdm(iterator.iterate(), desc=f"Looking for {name}", total=len(iterator)): + key = iterator.get_identifier() - # This is where you do the actual inference. + # This is where you do the actual inference. - # Some convenient properties of the current data. - # ``iterator.label_hash`` the label hash of the current data unit - # ``iterator.du_hash`` the data unit hash of - # ``iterator.frame`` the frame of the current data unit hash of - # ``iterator.num_frame`` the total number of frames in the label row. + # Some convenient properties of the current data. + # ``iterator.label_hash`` the label hash of the current data unit + # ``iterator.du_hash`` the data unit hash of + # ``iterator.frame`` the frame of the current data unit hash of + # ``iterator.num_frame`` the total number of frames in the label row. - # Do your thing (inference) - image = cv2.imread(img_pth.as_posix()) - image = cv2.cvtColor(image, cv2.COLOR_BGR2RGB) + # Do your thing (inference) + image = cv2.imread(img_pth.as_posix()) + image = cv2.cvtColor(image, cv2.COLOR_BGR2RGB) - writer.write_score(key, rank_by_brightness(image), "Brightness") + writer.write_score(key, rank_fn(image), "") if __name__ == '__main__': From ee941a2112992a5e4936fccf8d662bfac54776bc Mon Sep 17 00:00:00 2001 From: GorkemP <110481017+Gorkem-Encord@users.noreply.github.com> Date: Fri, 12 Aug 2022 13:23:09 +0300 Subject: [PATCH 5/5] Update .gitignore --- .gitignore | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.gitignore b/.gitignore index 6bcf7a74b..c3a3318d0 100644 --- a/.gitignore +++ b/.gitignore @@ -347,4 +347,5 @@ tags # End of https://www.toptal.com/developers/gitignore/api/macos,linux,vim,python,pycharm /conf/config.yaml /pocs/outputs/ -.idea \ No newline at end of file +.idea +/outputs/