Skip to content

Instantly share code, notes, and snippets.

View Totoro97's full-sized avatar
🎯
Focusing

Peng Wang Totoro97

🎯
Focusing
View GitHub Profile
@Totoro97
Totoro97 / preprecess_colmap.py
Created May 26, 2022 02:56
preprecess_colmap.py
import numpy as np
import os
import cv2 as cv
from glob import glob
from scipy.spatial.transform import Rotation as Rot
from shutil import copytree
scans = ['106']
# scans = []
import pyrender
import os
from pyrender import PerspectiveCamera,\
DirectionalLight, SpotLight, PointLight,\
MetallicRoughnessMaterial,\
Primitive, Mesh, Node, Scene,\
Viewer, OffscreenRenderer, RenderFlags
from pyrender.constants import RenderFlags
import trimesh
class SineLayer(nn.Module):
# See paper sec. 3.2, final paragraph, and supplement Sec. 1.5 for discussion of omega_0.
# If is_first=True, os a frequency factor which simply multiplies the activations before the
# nonlinearity. Different simega_0 signals may require different omega_0 in the first layer - this is a
# hyperparameter.
# If is_first=False, then the weights will be divided by omega_0 so as to keep the magnitude of
# activations constant, but boost gradients to the weight matrix (see supplement Sec. 1.5)
from matplotlib import pyplot as plt
import numpy as np
n_samples = 128
# pdf of logistic distribution
def pdf(x, std):
return 0.25 / std / np.cosh(0.5 * x / std)**2
import numpy as np
import cv2 as cv
import os
from glob import glob
from scipy.io import loadmat
import trimesh
def clean_points_by_mask(points, scan):
cameras = np.load('/home/aska/Projects/NeuS/public_data/dtu_scan{}/cameras_sphere.npz'.format(scan))
mask_lis = sorted(glob('/home/aska/Projects/NeuS/public_data/dtu_scan{}/mask/*.png'.format(scan)))
Size--> 5
0 1 2 3 4
5 6 7 8 9
10 11 12 13 14
15 16 17 18 19
20 21 22 23 24
X--> 1
0 X 2 3 4
5 6 7 8 9
10 11 12 13 14
#include <cstdio>
#include <cstring>
#include <algorithm>
#include <queue>
using namespace std;
queue <int> que;
double p[26],g[50][50],f[1 << 9][50];
int i,j,k,l,m,n,L,t,cl,top,st,T,len;
int nex[50][26],fail[50],vis[50];
int done[50],sing[50];
@Totoro97
Totoro97 / D.cpp
Created April 23, 2014 00:16
D.cpp
#include <cstdio>
#include <cstring>
#include <algorithm>
#include <vector>
#include <iostream>
#include <map>
#define intl long long
#define maxn 300100
using namespace std;
@Totoro97
Totoro97 / 感悟
Created April 17, 2014 11:56
感悟
2014-2-26
今天的考试没上一百分
T1:考场上想到正解 并打出 但是一开始只有20分:首先我程序的常数太大 一个点要跑2秒 再次题目的数据范围明明是50W而不是题目所说的10W。。。不过总而言之还是自己的算法不够优秀,虽然主席树和树状数组的复杂度都是logn的,但是主席树的常数还是太大了(没有仔细分析题目性质的后果,本来可以用树状数组为什么用主席树?)
于是:“在时间充裕的情况下,能不能想出更优秀的算法?”
T2:这道题以前做过类似的题目(BZOJ 1003),打完了以后觉得没有什么萎点,于是去想T1,后来只对了一个点,下午又调了好久才知道错误的原因:对set的熟练程度不够。
其实我知道set不允许重复元素的存在,但这个理解一直停留在表面:以为set<int> 里的a,b只要a != b就不是重复元素,后面才知道如果写了cmp函数的话。。set判重就靠cmp了。。。也就是说如果cmp(a,b)和cmp(b,a)都是false的话 就被set当成重复元素 然后就只会保留一个。。。于是嗯。。。就Wa了9个点。把set的cmp加上第二关键字就过去了。
幸亏有这次错误,要不然我都不知道以后什么时候会在某个大考试犯它。。。
T3:这一题没做,都去做前两题去了,其实这道题可以玩出很多分,提交答案题嘛。。
不过如果有界面的话这道题会非常好做(就是一个推箱子游戏)
向GY学习如何打界面!
#include <cstdio>
#include <cstring>
#include <algorithm>
#define N 2000
#define maxn 1000100
#define intl long long
using namespace std;
int i,j,k,l,m,n,T,v[maxn];
intl Mo,fac[maxn + 4010],ni[maxn + 4010],g[4010],f[4010],s[2010],js,ans;