- Make sure you have npm installed (tested with version 6.14.4, if you have a lower version then try updating it if you are unable to build the project).
- Run the following command in your console to install dependencies:
npm i
npm i --global webpack ts-node
- Install Redis - on Linux this should be possible through your package manager, but on Windows use an Ubuntu WSL environment
This project uses webpack for compilation in order to provide benefits like ES2018 syntax, TypeScript, and .tsx
/.jsx
file support.
Running the following command will make webpack watch files for changes and automatically recompile when you make changes:
npm run dev
To create a minified production build instead, run:
npm run build
- Build the javascript files using the steps above
- Install python 3.8+ (tested with 3.8.5)
- Install PostgreSQL and start running the postgres server
- Create a database in Postgres called "outcropsketch"
- In the root folder of the repository, create a new python virtual environment with
python -m venv env
- Install python requirements with
pip install -r requirements.txt
- Create a
.env
file in the root directory of the repo to fill in with sensitive information like database credentials. Use the default one below as a template and replace values with ones for your configuration:
DJANGO_SECRET_KEY=123456 # Secret key for django server to use, value doesn't matter except in production
GOOGLE_CREDENTIAL_FILE=outcropsketch-123456789.json # Name of Google service account credential json file located in the webserver folder
POSTGRES_HOST=127.0.0.1
POSTGRES_PORT=5432
POSTGRES_USER=postgres
POSTGRES_PASSWORD=password
- Run
sudo service redis-server start
to use Redis as a Celery message broker - Run Celery in a background process:
cd webserver
celery -A outcropsketch worker
(on Windows, you will need to use WSL or add -P solo
to the end of this command as Celery does not officially support Windows)
9. Run the server by running python webserver/manage.py runserver
and visiting 127.0.0.1:8000 in your browser
- If it doesn't already exist, create a folder named
input
in the root directory of the project - Put all the .json files you want to convert in the
input
folder - Run the following command to convert all .json files into image and .csv files:
npm run convert-json
- Check the
converted/x
folder to find the source images, andconverted/y
for .csv label files. - Run the following command to convert the
.csv
files into.png
files with labels:
python utils/csv_to_png.py
- Check the
converted/StructureTypeLabels
folder for the structure types, andconverted/StructureTypeLabels
for surface types.