本文整理匯總了Python中os.path.curdir方法的典型用法代碼示例。如果您正苦於以下問題:Python path.curdir方法的具體用法?Python path.curdir怎麽用?Python path.curdir使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類os.path
的用法示例。
在下文中一共展示了path.curdir方法的10個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: resnet
# 需要導入模塊: from os import path [as 別名]
# 或者: from os.path import curdir [as 別名]
def resnet(n=3, num_output = 16):
"""6n+2, n=3 9 18 coresponds to 20 56 110 layers"""
net_name = "resnet-"
pt_folder = osp.join(osp.abspath(osp.curdir), net_name +str(6*n+2))
name = net_name+str(6*n+2)+'-cifar10'
if n > 18:
# warm up
solver = Solver(solver_name="solver_warm.prototxt", folder=pt_folder, lr_policy=Solver.policy.fixed)
solver.p.base_lr = 0.01
solver.set_max_iter(500)
solver.write()
del solver
solver = Solver(folder=pt_folder)
solver.write()
del solver
builder = Net(name)
builder.Data('cifar-10-batches-py/train', phase='TRAIN', crop_size=32)
builder.Data('cifar-10-batches-py/test', phase='TEST')
builder.resnet_cifar(n, num_output=num_output)
builder.write(folder=pt_folder)
示例2: resnet_orth
# 需要導入模塊: from os import path [as 別名]
# 或者: from os.path import curdir [as 別名]
def resnet_orth(n=3):
"""6n+2, n=3 9 18 coresponds to 20 56 110 layers"""
net_name = "resnet-orth-"
pt_folder = osp.join(osp.abspath(osp.curdir), net_name +str(6*n+2))
name = net_name+str(6*n+2)+'-cifar10'
if n > 18:
# warm up
solver = Solver(solver_name="solver_warm.prototxt", folder=pt_folder, lr_policy=Solver.policy.fixed)
solver.p.base_lr = 0.01
solver.set_max_iter(500)
solver.write()
del solver
solver = Solver(folder=pt_folder)
solver.write()
del solver
builder = Net(name)
builder.Data('cifar-10-batches-py/train', phase='TRAIN', crop_size=32)
builder.Data('cifar-10-batches-py/test', phase='TEST')
builder.resnet_cifar(n, orth=True)
builder.write(folder=pt_folder)
示例3: resnet_orth_v2
# 需要導入模塊: from os import path [as 別名]
# 或者: from os.path import curdir [as 別名]
def resnet_orth_v2(n=3):
"""6n+2, n=3 9 18 coresponds to 20 56 110 layers"""
net_name = "resnet-orth-v2"
pt_folder = osp.join(osp.abspath(osp.curdir), net_name +str(6*n+2))
name = net_name+str(6*n+2)+'-cifar10'
if n > 18:
# warm up
solver = Solver(solver_name="solver_warm.prototxt", folder=pt_folder, lr_policy=Solver.policy.fixed)
solver.p.base_lr = 0.01
solver.set_max_iter(500)
solver.write()
del solver
solver = Solver(folder=pt_folder)
solver.write()
del solver
builder = Net(name)
builder.Data('cifar-10-batches-py/train', phase='TRAIN', crop_size=32)
builder.Data('cifar-10-batches-py/test', phase='TEST')
builder.resnet_cifar(n, orth=True, v2=True)
builder.write(folder=pt_folder)
示例4: run
# 需要導入模塊: from os import path [as 別名]
# 或者: from os.path import curdir [as 別名]
def run(self):
ind=self.qu.get()
url=self.url+str(ind)
soup =bs.BeautifulSoup(''.join( ul.urlopen(url).readlines() ))
bu = up.urlsplit(self.url)
print 'started with the ' ,str(url).split('/')[-1],
for i in soup.find_all(attrs = { "class" : "recipe-title"}):
sp = up.urlsplit(i.a.get('href'))
path = sp.path
print path
if re.search(pat, path):
path = bu.scheme+'://'+bu.netloc+path
filename = str(path).split('/')[-2]
filename = op.join(op.abspath(op.curdir),filename+'.py') # recipe will be stored in given location
# filename = op.join(op.abspath(op.curdir),filename+'.html')
#uncomment the above line if downloading the web page for teh recipe
print path
self.q.put((path,filename))
self.fetch_data()
time.sleep(1)
self.qu.task_done()
self.q.join()
print 'done with the ' ,str(url).split('/')[-1],
示例5: plain
# 需要導入模塊: from os import path [as 別名]
# 或者: from os.path import curdir [as 別名]
def plain(n=3):
"""6n+2, n=3 9 18 coresponds to 20 56 110 layers"""
net_name = "plain"
pt_folder = osp.join(osp.abspath(osp.curdir), net_name +str(6*n+2))
name = net_name+str(6*n+2)+'-cifar10'
solver = Solver(folder=pt_folder)
solver.write()
del solver
builder = Net(name)
builder.Data('cifar-10-batches-py/train', phase='TRAIN', crop_size=32)
builder.Data('cifar-10-batches-py/test', phase='TEST')
builder.plain_cifar(n, num_output = 16)
builder.write(folder=pt_folder)
示例6: plain_orth
# 需要導入模塊: from os import path [as 別名]
# 或者: from os.path import curdir [as 別名]
def plain_orth(n=3):
"""6n+2, n=3 5 7 9 18 coresponds to 20 56 110 layers"""
net_name = "plain-orth"
pt_folder = osp.join(osp.abspath(osp.curdir), net_name +str(6*n+2))
name = net_name+str(6*n+2)+'-cifar10'
solver = Solver(folder=pt_folder)
solver.write()
del solver
builder = Net(name)
builder.Data('cifar-10-batches-py/train', phase='TRAIN', crop_size=32)
builder.Data('cifar-10-batches-py/test', phase='TEST')
builder.plain_cifar(n, orth=True)
builder.write(folder=pt_folder)
示例7: acc
# 需要導入模塊: from os import path [as 別名]
# 或者: from os.path import curdir [as 別名]
def acc(n=3):
"""6n+2, n=3 9 18 coresponds to 20 56 110 layers"""
net_name = "plain"
pt_folder = osp.join(osp.abspath(osp.curdir), net_name +str(6*n+2))
name = net_name+str(6*n+2)+'-cifar10'
solver = Solver(folder=pt_folder)
solver.write()
del solver
builder = Net(name)
builder.Data('cifar-10-batches-py/train', phase='TRAIN', crop_size=32)
builder.Data('cifar-10-batches-py/test', phase='TEST')
builder.plain_cifar(n, num_output = 16, inplace=False)
builder.write(folder=pt_folder)
示例8: on_selectpath_clicked
# 需要導入模塊: from os import path [as 別名]
# 或者: from os.path import curdir [as 別名]
def on_selectpath_clicked(self):
dialog = QFileDialog()
dialog.setFileMode(QFileDialog.Directory);
dialog.setOption(QFileDialog.ShowDirsOnly);
result = dialog.getExistingDirectory(self, 'Choose Directory', path.curdir)
if result: self.imgpath.setText(result)
示例9: run_command
# 需要導入模塊: from os import path [as 別名]
# 或者: from os.path import curdir [as 別名]
def run_command(command, shell=False, cwd=path.curdir, env=environ,
stdin=None, default=None):
"""Run a generic command in a subprocess.
Args:
command (str): command to run
stdin: The standard input channel for the started process.
default (andy): The default return value in case run fails.
Returns:
str: raw command output or default value
"""
output_text = default
try:
startupinfo = None
if sublime.platform() == "windows":
# Don't let console window pop-up briefly.
startupinfo = subprocess.STARTUPINFO()
startupinfo.dwFlags |= subprocess.STARTF_USESHOWWINDOW
startupinfo.wShowWindow = subprocess.SW_HIDE
if stdin is None:
stdin = subprocess.PIPE
output = subprocess.check_output(command,
stdin=stdin,
stderr=subprocess.STDOUT,
shell=shell,
cwd=cwd,
env=env,
startupinfo=startupinfo)
output_text = ''.join(map(chr, output))
except subprocess.CalledProcessError as e:
output_text = e.output.decode("utf-8")
_log.debug("Command finished with code: %s", e.returncode)
_log.debug("Command output: \n%s", output_text)
except OSError:
_log.debug(
"Executable file not found executing: {}".format(command))
return output_text
示例10: which
# 需要導入模塊: from os import path [as 別名]
# 或者: from os.path import curdir [as 別名]
def which(cmd, mode=os.F_OK | os.X_OK, path=None):
"""
Given cmd, check where it is on PATH.
Loosely based on the version in python 3.3.
"""
if os.path.dirname(cmd):
if os.path.isfile(cmd) and os.access(cmd, mode):
return cmd
if path is None:
path = os.environ.get('PATH', defpath)
if not path:
return None
paths = path.split(pathsep)
if sys.platform == 'win32':
# oh boy
if curdir not in paths:
paths = [curdir] + paths
# also need to check the fileexts...
pathext = os.environ.get('PATHEXT', '').split(pathsep)
if any(cmd.lower().endswith(ext.lower()) for ext in pathext):
files = [cmd]
else:
files = [cmd + ext for ext in pathext]
else:
# sanity
files = [cmd]
seen = set()
for p in paths:
normpath = normcase(p)
if normpath in seen:
continue
seen.add(normpath)
for f in files:
fn = os.path.join(p, f)
if os.path.isfile(fn) and os.access(fn, mode):
return fn
return None