Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
A
AVVR-Pipeline-GDP4
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Deploy
Releases
Package registry
Model registry
Operate
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
GDP Project 4
AVVR-Pipeline-GDP4
Merge requests
!9
GDP 4.4.5
Code
Review changes
Check out branch
Download
Patches
Plain diff
Merged
GDP 4.4.5
GDP_4.4.5
into
master
Overview
0
Commits
5
Changes
3
Merged
las1g21
requested to merge
GDP_4.4.5
into
master
6 months ago
Overview
0
Commits
5
Changes
3
Expand
Access to Iridis
0
0
Merge request reports
Compare
master
master (base)
and
latest version
latest version
9184edeb
5 commits,
6 months ago
3 files
+
141
−
1
Inline
Compare changes
Side-by-side
Inline
Show whitespace changes
Show one file at a time
Files
3
Search (e.g. *.vue) (Ctrl+P)
scripts/scene_completion.py
0 → 100644
+
138
−
0
Options
import
paramiko
from
dotenv
import
load_dotenv
from
scp
import
SCPClient
import
os
import
subprocess
import
time
load_dotenv
()
hostname
=
os
.
getenv
(
"
HOSTNAME
"
)
username
=
os
.
getenv
(
"
USERNAME
"
)
password
=
os
.
getenv
(
"
PASSWORD
"
)
def
send_files
(
shifted_disparity_path
,
shifted_t_path
):
# sends two files needed to iridis
# files keep their names. NAMES MUST BE shifted_disparity.png AND shifted_t.png
command
=
[
"
scp
"
,
shifted_disparity_path
,
f
"
{
username
}
@
{
hostname
}
:
{
os
.
getenv
(
"
REMOTE_INPUT_PATH
"
)
}
"
]
try
:
subprocess
.
run
(
command
,
check
=
True
)
except
subprocess
.
CalledProcessError
as
e
:
print
(
f
"
Error during SCP:
{
e
}
"
)
return
False
,
False
command
=
[
"
scp
"
,
shifted_t_path
,
f
"
{
username
}
@
{
hostname
}
:
{
os
.
getenv
(
"
REMOTE_INPUT_PATH
"
)
}
"
]
try
:
subprocess
.
run
(
command
,
check
=
True
)
except
subprocess
.
CalledProcessError
as
e
:
print
(
f
"
Error during SCP:
{
e
}
"
)
return
False
,
False
return
True
def
get_completed_scene
(
shifted_disparity_path
,
shifted_t_path
):
if
send_files
(
shifted_disparity_path
,
shifted_t_path
):
client
=
paramiko
.
SSHClient
()
client
.
set_missing_host_key_policy
(
paramiko
.
AutoAddPolicy
())
# Connect to the server
try
:
client
.
connect
(
hostname
,
username
=
username
,
password
=
password
)
print
(
"
SSH connection established.
"
)
# Check if the connection is active
if
client
.
get_transport
().
is_active
():
print
(
"
Connection is active.
"
)
else
:
print
(
"
Connection is not active.
"
)
return
False
,
False
except
Exception
as
e
:
print
(
f
"
Failed to connect to
{
hostname
}
:
{
e
}
"
)
return
False
,
False
stdin
,
stdout
,
stderr
=
client
.
exec_command
(
"
cd mona/MDBNet360_GDP/
"
+
"
&& module load conda
"
+
"
&& source activate
"
+
"
&& conda activate ssc_env
"
+
"
&& sbatch --partition=ecsstudents --account=ecsstudents run_enhance360_job.sh
"
)
output
=
stdout
.
read
().
decode
()
print
(
output
)
stdin
,
stdout
,
stderr
=
client
.
exec_command
(
"
squeue -lu kproject
"
)
output
=
stdout
.
read
().
decode
()
print
(
output
)
time
.
sleep
(
30
)
while
"
RUNNING
"
in
output
:
print
(
"
Sleeping for 30
"
)
time
.
sleep
(
30
)
stdin
,
stdout
,
stderr
=
client
.
exec_command
(
"
squeue -lu kproject
"
)
output
=
stdout
.
read
().
decode
()
print
(
output
)
print
(
"
Finish Enhancing
"
)
stdin
,
stdout
,
stderr
=
client
.
exec_command
(
"
cd mona/MDBNet360_GDP/
"
+
"
&& module load conda
"
+
"
&& source activate
"
+
"
&& conda activate ssc_env
"
+
"
&& sbatch --partition=ecsstudents --account=ecsstudents run_obj_job.sh
"
)
output
=
stdout
.
read
().
decode
()
print
(
output
)
stdin
,
stdout
,
stderr
=
client
.
exec_command
(
"
squeue -lu kproject
"
)
output
=
stdout
.
read
().
decode
()
print
(
output
)
time
.
sleep
(
30
)
while
"
RUNNING
"
in
output
:
print
(
"
Sleeping for 30
"
)
time
.
sleep
(
30
)
stdin
,
stdout
,
stderr
=
client
.
exec_command
(
"
squeue -lu kproject
"
)
output
=
stdout
.
read
().
decode
()
print
(
output
)
remote_file_path
=
"
/mainfs/ECShome/kproject/mona/MDBNet360_GDP/output/scene_completed_prediction.obj
"
local_file_path
=
"
edgenet-360/Data/Input/scene_completed_prediction.obj
"
with
SCPClient
(
client
.
get_transport
())
as
scp
:
scp
.
get
(
remote_file_path
,
local_file_path
)
# Download file
print
(
"
OUTPUT DOWNLOADED
"
)
# Close the SSH connection
client
.
close
()
return
True
,
local_file_path
else
:
return
False
,
False
# out = get_completed_scene("C:\\Project\\AVVR-Pipeline-GDP4\\edgenet-360\\Data\\Courtyard\\shifted-disparity.png", "C:\\Project\\AVVR-Pipeline-GDP4\\edgenet-360\\Data\\Courtyard\\shifted_t.png")
# print(out)
if
__name__
==
"
__main__
"
:
if
len
(
sys
.
argv
)
!=
3
:
print
(
"
Usage: python shifter.py <shifted_disparity_path> <shifted_t_path>
"
)
sys
.
exit
(
1
)
shifted_disparity_path
=
sys
.
argv
[
1
]
shifted_t_path
=
sys
.
argv
[
2
]
saved_path
=
get_completed_scene
(
shifted_disparity_path
,
shifted_t_path
)
print
(
f
"
Shifted image saved as
{
saved_path
}
"
)
\ No newline at end of file
Loading