Step 1. Take a video for 1 minute
Step 5. Export Mesh
Step 6. Smoothing and Scaling and removing noise
apiVersion: argoproj.io/v1alpha1
kind: WorkflowTemplate
metadata:
name: instant-ngp-v56-i584986
annotations:
scenarios.ai.sap.com/description: "Yong Auto instant-ngp 3D Rendering"
scenarios.ai.sap.com/name: "yong-instant-ngp-train"
executables.ai.sap.com/description: "yong Auto instant-ngp 3D Rendering executable"
executables.ai.sap.com/name: "yong-instant-ngp-executable"
artifacts.ai.sap.com/image-data-v1.kind: "dataset"
artifacts.ai.sap.com/image-model-v1.kind: "model" #model - default - object store secret
labels:
scenarios.ai.sap.com/id: "yong-instant-ngp"
executables.ai.sap.com/id: "yong-instant-ngp-training"
ai.sap.com/version: "1.0.0"
spec:
imagePullSecrets:
- name: credentialrepo-i584986
entrypoint: image-instant-ngp-training
templates:
- name: image-instant-ngp-training
metadata:
labels:
ai.sap.com/resourcePlan: infer.l
inputs:
artifacts:
- name: image-data-v1
path: /volume/
outputs:
artifacts:
- name: image-model-v1
path: /model/
globalName: image-model-v1
archive:
none: {}
container:
image: "docker.io/ertyu116/instantngp:v7"
ports:
- containerPort: 9001
protocol: TCP
imagePullPolicy: Always
command: ["/bin/sh", "-c"]
args:
- >
set -e && echo "---Start Training---" &&cmake -DNGP_BUILD_WITH_GUI=off ./ -B ./build && cmake --build build --config RelWithDebInfo -j 8 && python3 ./scripts/colmap2nerf.py --video_in /volume/IMG_0184.MOV --video_fps 2 --run_colmap --aabb_scale 2 --out /volume/transforms.json --overwrite && ls /volume/ && python3 ./scripts/run.py --scene /volume --save_snapshot /model/base.msgpack --save_mesh /model/base.obj --train --n_steps 35000 && echo "---End Training---"
yaml file for SAP AI Core
SAP AI Core
const raycaster = new THREE.Raycaster()
let intersects
const mouse = new THREE.Vector2()
renderer.domElement.addEventListener('pointerdown', onClick, false)
function onClick(event) {
if (ctrlDown) {
raycaster.setFromCamera(mouse, camera)
intersects = raycaster.intersectObjects(pickableObjects, false)
if (intersects.length > 0) {
if (!drawingLine) {
//start the line
const points = []
points.push(intersects[0].point)
points.push(intersects[0].point.clone())
const geometry = new THREE.BufferGeometry().setFromPoints(points)
line = new THREE.LineSegments(
geometry,
new THREE.LineBasicMaterial({
color: 0x00000,
linewidth: 5,
transparent: true,
opacity: 1.00,
// depthTest: false,
// depthWrite: false
})
)
line.frustumCulled = false
scene.add(line)
const measurementDiv = document.createElement('div')
measurementDiv.className = 'measurementLabel'
measurementDiv.innerText = '0.0cm'
const measurementLabel = new CSS2DObject(measurementDiv)
measurementLabel.position.copy(intersects[0].point)
measurementLabels[lineId] = measurementLabel
scene.add(measurementLabels[lineId])
drawingLine = true
} else {
//finish the line
const positions = line.geometry.attributes.position.array
positions[3] = intersects[0].point.x
positions[4] = intersects[0].point.y
positions[5] = intersects[0].point.z
line.geometry.attributes.position.needsUpdate = true
lineId++
drawingLine = false
}
}
}
}
document.addEventListener('mousemove', onDocumentMouseMove, false)
function onDocumentMouseMove(event) {
event.preventDefault()
mouse.x = (event.clientX / window.innerWidth) * 2 - 1
mouse.y = -(event.clientY / window.innerHeight) * 2 + 1
if (drawingLine) {
raycaster.setFromCamera(mouse, camera)
intersects = raycaster.intersectObjects(pickableObjects, false)
if (intersects.length > 0) {
const positions = line.geometry.attributes.position.array
const v0 = new THREE.Vector3(positions[0], positions[1], positions[2])
const v1 = new THREE.Vector3(
intersects[0].point.x,
intersects[0].point.y,
intersects[0].point.z
)
positions[3] = intersects[0].point.x
positions[4] = intersects[0].point.y
positions[5] = intersects[0].point.z
line.geometry.attributes.position.needsUpdate = true
const distance = v0.distanceTo(v1)
measurementLabels[lineId].element.innerText = distance.toFixed(2) + 'cm'
measurementLabels[lineId].position.lerpVectors(v0, v1, 0.5)
// console.log('Distance:', distance);
}
}
}
measurement code for 3D object
# Use an official Node.js image as the base
FROM node:14-alpine
# Set the working directory in the container
WORKDIR /app
# Copy all file to Docker
COPY . .
# Expose the port that your application will run on
EXPOSE 80
# Start a simple HTTP server to serve the HTML file
CMD ["npx", "http-server", "-p", "80", "-c-1", "."]
Dockerfile for three js
apiVersion: v1
kind: Namespace
metadata:
name: yongyun-mythreejs
labels:
istio-injection: enabled
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: my-threjs-app
namespace: yongyun-mythreejs
spec:
replicas: 1
selector:
matchLabels:
app: my-threjs-app
template:
metadata:
labels:
app: my-threjs-app
version: v1
spec:
containers:
- name: my-threjs-app
image: ertyu116/my-threejs-app:v13
imagePullPolicy: Always
resources:
limits:
memory: "128Mi"
cpu: "500m"
requests:
memory: "32Mi"
ports:
- containerPort: 80
name: http
---
apiVersion: v1
kind: Service
metadata:
name: my-threjs-app-service-v1
labels:
app: my-threjs-app
spec:
selector:
app: my-threjs-app
ports:
- protocol: TCP
port: 80
targetPort: 80
---
apiVersion: gateway.kyma-project.io/v1alpha1
kind: APIRule
metadata:
name: yongyun-mythreejs
namespace: yongyun-mythreejs
spec:
gateway: kyma-gateway.kyma-system.svc.cluster.local
service:
name: my-threjs-app-service-v1
port: 80
host: yongyun-mythreejs
rules:
- accessStrategies:
- handler: allow
methods: ["GET", "POST"]
path: /.*
mutators: []
yaml file for SAP BTP kyma
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
29 | |
13 | |
13 | |
10 | |
9 | |
9 | |
9 | |
8 | |
7 | |
7 |