Sign inSign up

antiprismus/visualization

By antiprismus

Updated almost 4 years ago

This image deploys a visualization UI used to analyse AI-classified images.

Image
0

213

antiprismus/visualization repository overview

Data visualization project

This project aims at providing a clear and easy-to-use visualization tool for AI analysed images. The most important thing to keep in mind is how data should be structured for this image to be able to run.

I. Folder structure

This image requires a mount to a specific folder that contains the needed data to run. The folder containing this data should be structured exactly as following :

📂static
┣ 📂data
┃ ┣ 📜distance_fifth.csv
┃ ┣ 📜distance_first.csv
┃ ┣ 📜distance_fourth.csv
┃ ┣ 📜distance_second.csv
┃ ┣ 📜distance_third.csv
┃ ┣ 📜neighbor_fifth.csv
┃ ┣ 📜neighbor_first.csv
┃ ┣ 📜neighbor_fourth.csv
┃ ┣ 📜neighbor_second.csv
┃ ┗ 📜neighbor_third.csv
┣ 📂files
┃ ┗ 📂production
┃ ┃ ┣ 📜completedTree.json
┃ ┃ ┣ 📜keyword_ranking_for_app.json
┃ ┃ ┣ 📜short_keywords_for_app.json
┃ ┃ ┗ 📜short_properties_for_app_new.json
┣ 📂images
┗ 📂pdf

Data

This folder contains two types of files :

  • distance_{level}.csv
  • neighbor_{level}.csv The first file correspond to the distance between each nodes. The second file is a mapping representing the 10 best matching node for each node.

These files can be generated from embeddings using this script from the source code of the app. Run it with this command : py get_distance_neighbor.py name_of_your_embedding.csv your/output/folder/path

There should always be five levels

Files

All files must be placed in the production folder.

completedTree.json

This file describes the structure of the tree graph. Once again, five levels must be described (plus the root level). The parent field is a bit more complicated; it represents the index of the parent class in the previous node. For the example bellow, it basically means that for the third node, the parent of "Well section" is the first index of the second node, which is "Cross section".

[
	[
		{ "name": "root" }
	],
	[
		{ "name": "Cross section", "parent": 0},
		{ "name": "Maps", "parent": 0},
		{ "name": "Graphs and Tables", "parent": 0},
		{ "name": "Photos", "parent": 0}
	],
	[
		{ "name": "Well section", "parent": 0},
		{ "name": "Geology", "parent": 0},
		{ "name": "One time", "parent": 1},
		{ "name": "Permanent", "parent": 1},
		{ "name": "Results", "parent": 2},
		{ "name": "Description", "parent": 2},
		{ "name": "Photos", "parent": 3}
	]
]
keyword_ranking_for_app.json

This file describes all the available keywords, classified by rank.

[
	{
	"Rank 1": "forage_sondage",
	"Rank 2": "drilling/forage",
	"Rank 3": "carottage carottages carotte carottes carottés carottier forage forages foration 	nivelés nivellement ouvrage ouvrages piezair piézairs piézogaz piezometre piezometres piézomètres piezometrie piézométrie piezometrique piézométrique piézométriques piezos puits sondage sondage sondages sondages well"
	},
	{
	"Rank 1": "lithologie",
	"Rank 2": "lithologie",
	"Rank 3": "argile argiles argiles argileuse argileux argilo balast ballast bitume bitumineuse bitumineux cailloux calcaire calcaires ciment cimentation granulométrique gravats graveleuse graveleuses graveleux gravier graviers gypse limon limoneuse limoneuses limoneux limono limons lithologie lithologique porosité remblai remblais remblayage sable sables sableuse sableuses sableux"
	}
]
short_keywords_for_app.json

This file describes the keywords present for each node, classified by rank and field (tesseract, caption and page_text). The id correspond to a node id.

[
	{
	"id": 1,
	"tesseract_keyword_rank1": "milieux",
	"tesseract_keyword_rank2": "sol",
	"tesseract_keyword_rank3": "",
	"caption_keyword_rank1": "",
	"caption_keyword_rank2": "",
	"caption_keyword_rank3": "",
	"page_text_keyword_rank1": "forage_sondage, milieux",
	"page_text_keyword_rank2": "drilling/forage, sol",
	"page_text_keyword_rank3": "carotte, forage, terre"
	}
]
short_properties_for_app_new.json

This file also describes the content of a node. It gives several crucial informations and should be treated carefully.
Important things to keep in mind

  • Path : the path of your image inside the image folder (as described in the data structure)
  • page : the page number where the image can be found in its pdf file (⚠️ we add +1 to this number at runtime)
  • converted_timeline : the formatted date of the document. It has to be of format yyyy-mm-dd. This field can be empty.

If any field is empty, it should be marked as null, if not, dubious behaviour may occur.

[
	{
	"id": 1,
	"Path": "path/to/my/image/my_image.png",
	"page": 9,
	"caption": "Figure 1 : Localisation du site (extrait de la carte IGN, source : Géoportail.fr)",
	"tesseract": "A RTS SU Se Zone d tude 48",
	"report_name": "my_report_name",
	"site_name": "Saint-Jean-de-La-Ruelle",
	"page_text": null,
	"timeline": "Juin 2017",
	"converted_timeline": "2017-06-01",
	"path_to_report": "path/to/my/report.pdf",
	"level1": "Maps",
	"level2": "Permanent",
	"level3": "Maps Geology",
	"level4": "Maps Geology",
	"level5": "Maps Geology",
	"pred level1": "Maps",
	"pred level2": "Permanent",
	"pred level3": "Maps Geology",
	"pred level4": "Maps Geology",
	"pred level5": "Maps Geology"
	}
]
images

This folder must contain all your images. Be minded that the path as described in the short_properties_for_app_new.json should match the structure of this folder.

pdf

Same principle as the image folder but for pdf reports.

II. Run

In order to run this program, Docker should be installed on the user's computer. Once this is done, update the project :

docker pull antiprismus/visualization

And then execute the run command :

docker container run -p 8080:80 -d --mount type=bind,source=C:/absolute/path/to/my/ressource/folder,target=/usr/share/nginx/html/static antiprismus/visualization

⚠️ Beware that the path to your resource folder must be absolute !

The first run may take a while. The website will run on your computer at localhost:8080. You can change this port by changing the -p 8080:80 command, for instance -p 70:80 if you want your app running on the port 70.

Tag summary

Content type

Image

Digest

sha256:1f4a0edce

Size

10.7 MB

Last updated

almost 4 years ago

docker pull antiprismus/visualization