readme
This commit is contained in:
@@ -1 +1,25 @@
|
||||
# SpeckleHackathon-ImgToPointCloud
|
||||
# Speckle ML demo app (image to pointcloud)
|
||||
|
||||
**WARNING**: This repo is the result of a 1day hackathon and is very unstructured.
|
||||
|
||||
Description of directories:
|
||||
- `python-connect`: quick proof of concept way of sending pointclouds to a speckle server
|
||||
- `web-app`: The frontend Vue app
|
||||
- `server`: The final backend (includes a copy of the built frontend, for serving)
|
||||
|
||||
---
|
||||
The `server` directory started with a clone of the ML model repository that can be found at https://github.com/ialhashim/DenseDepth
|
||||
|
||||
In there, there are some extra files that were added/modified:
|
||||
- `cherry.py` - the startup script for this app
|
||||
- `run.py` - edited from a previous script - the pre-processing and post-processing logic
|
||||
- `sp.py` - utility to send pointclouds to a speckle server
|
||||
- `Dockerfile` - for building a docker image with this app
|
||||
- `Makefile` - build and run commands for easily build and run the docker image
|
||||
|
||||
To build the app:
|
||||
- go into the `server` directory
|
||||
- follow the instructions in the original `README.md` to download the NYU pretrained model.
|
||||
- run `make build`
|
||||
- edit `Makefile` to include your config
|
||||
- run `make run`
|
||||
|
||||
@@ -7,3 +7,9 @@ RUN pip3 install scikit-learn scikit-image
|
||||
RUN pip3 uninstall -y enum34
|
||||
RUN pip3 install specklepy cherrypy
|
||||
RUN pip3 install cherrypy-cors
|
||||
|
||||
COPY . /app
|
||||
|
||||
WORKDIR /app
|
||||
|
||||
CMD ["python3", "cherry.py"]
|
||||
|
||||
+4
-3
@@ -3,6 +3,7 @@ build:
|
||||
|
||||
run:
|
||||
docker run -it --rm --net=host \
|
||||
-v /w/speckle/SpeckleHackathon-ImgToPointCloud/server:/app \
|
||||
i2pc bash
|
||||
# docker run -it --rm -v /w/speckle/DenseDepth:/app --gpus all i2pc bash
|
||||
-e SPECKLE_SERVER=https://speckle.xyz \
|
||||
-e SPECKLE_TOKEN=TODO_ADD_TOKEN \
|
||||
i2pc
|
||||
|
||||
|
||||
+22
-9
@@ -27,15 +27,15 @@ class App:
|
||||
return 'OK'
|
||||
upload_file = '/tmp/imgfile'
|
||||
size = 0
|
||||
with open(upload_file, 'wb') as out:
|
||||
while True:
|
||||
data = imgfile.file.read(8192)
|
||||
if not data:
|
||||
break
|
||||
out.write(data)
|
||||
size += len(data)
|
||||
|
||||
with LOCK:
|
||||
with open(upload_file, 'wb') as out:
|
||||
while True:
|
||||
data = imgfile.file.read(8192)
|
||||
if not data:
|
||||
break
|
||||
out.write(data)
|
||||
size += len(data)
|
||||
|
||||
return createPC(['/tmp/imgfile'])
|
||||
|
||||
|
||||
@@ -60,6 +60,19 @@ config = {
|
||||
}
|
||||
|
||||
|
||||
def init_thread():
|
||||
# Call `/init` to load the ml model in the cherrypy thread
|
||||
# (Models can only be used in the same thread that loaded the model)
|
||||
import time, requests
|
||||
time.sleep(2)
|
||||
try:
|
||||
requests.get('http://127.0.0.1:8080/init')
|
||||
except:
|
||||
pass
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
cherrypy.quickstart(App(), '/', config)
|
||||
t = threading.Thread(target=init_thread)
|
||||
t.setDaemon(True)
|
||||
t.start()
|
||||
cherrypy.quickstart(App(), '/', config)
|
||||
|
||||
+2
-2
@@ -62,8 +62,8 @@ def store_pointcloud(pc):
|
||||
object_id=hash,
|
||||
message="this is a point cloud array"
|
||||
)
|
||||
# return 'http://anthe.local/streams/' + new_stream_id
|
||||
return 'https://latest.speckle.dev/streams/' + new_stream_id
|
||||
|
||||
return os.environ['SPECKLE_SERVER'] + '/streams/' + new_stream_id
|
||||
|
||||
|
||||
def main():
|
||||
|
||||
@@ -1 +1 @@
|
||||
<!DOCTYPE html><html lang="en"><head><meta charset="utf-8"><meta http-equiv="X-UA-Compatible" content="IE=edge"><meta name="viewport" content="width=device-width,initial-scale=1"><link rel="icon" href="/favicon.ico"><title>object-table</title><link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Roboto:100,300,400,500,700,900"><link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@mdi/font@latest/css/materialdesignicons.min.css"><link href="/css/chunk-vendors.67ffdf8a.css" rel="preload" as="style"><link href="/js/app.c852a86b.js" rel="preload" as="script"><link href="/js/chunk-vendors.0332b159.js" rel="preload" as="script"><link href="/css/chunk-vendors.67ffdf8a.css" rel="stylesheet"></head><body><noscript><strong>We're sorry but object-table doesn't work properly without JavaScript enabled. Please enable it to continue.</strong></noscript><div id="app"></div><script src="/js/chunk-vendors.0332b159.js"></script><script src="/js/app.c852a86b.js"></script></body></html>
|
||||
<!DOCTYPE html><html lang="en"><head><meta charset="utf-8"><meta http-equiv="X-UA-Compatible" content="IE=edge"><meta name="viewport" content="width=device-width,initial-scale=1"><link rel="icon" href="/favicon.ico"><title>object-table</title><link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Roboto:100,300,400,500,700,900"><link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@mdi/font@latest/css/materialdesignicons.min.css"><link href="/css/chunk-vendors.67ffdf8a.css" rel="preload" as="style"><link href="/js/app.5768e71f.js" rel="preload" as="script"><link href="/js/chunk-vendors.0332b159.js" rel="preload" as="script"><link href="/css/chunk-vendors.67ffdf8a.css" rel="stylesheet"></head><body><noscript><strong>We're sorry but object-table doesn't work properly without JavaScript enabled. Please enable it to continue.</strong></noscript><div id="app"></div><script src="/js/chunk-vendors.0332b159.js"></script><script src="/js/app.5768e71f.js"></script></body></html>
|
||||
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
+1
-1
@@ -14,7 +14,7 @@
|
||||
transition="scale-transition"
|
||||
width="40"
|
||||
/>
|
||||
<v-toolbar-title>Pointcloud Generator</v-toolbar-title>
|
||||
<v-toolbar-title>Pointcloud Generator - Alpha version - MachineLearning ProofOfConcept</v-toolbar-title>
|
||||
</div>
|
||||
</v-app-bar>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user