text
stringlengths 1
93.6k
|
|---|
cond3 = np.sum(sam_==idi)
|
if ol_rate * cond3 < cond1 and (cond1 > cond2 * ol_rate or cond1 < cond2 * 0.2):
|
partid1 = part_dicts[(idx, idf)]
|
vertices[partid1].append(partid0)
|
vertices[partid0].append(partid1)
|
for k,v in vertices.items():
|
vertices[k] = np.unique(v).tolist() # clear all edeges
|
visited = {}
|
for idx in range(len(vertices)):
|
visited[idx] = False
|
val_parts = {}
|
largest = [0,0]
|
find_connected_parts(vertices, visited, val_parts, mask_cents, largest)
|
### remove isolated parts with centers that are nearby to its isolated counterparts
|
cents = []
|
isolations, iso_cents = [], []
|
if isoproc:
|
for k,v in val_parts.items():
|
if len(vertices[v]) > 0:
|
cents.append(mask_cents[v][0].reshape(1,-1))
|
else:
|
isolations.append(v)
|
iso_cents.append(mask_cents[v][0].reshape(1,-1))
|
else:
|
for k,v in val_parts.items():
|
cents.append(mask_cents[v][0].reshape(1,-1))
|
# process isolated parts
|
if len(iso_cents) > 0:
|
val_parts_iso = {}
|
count_k = 0
|
for k in isolations:
|
val_parts_iso[count_k] = k
|
count_k += 1
|
for k,v in val_parts_iso.items():
|
cents.append(mask_cents[v][0].reshape(1,-1))
|
# record the number of non-isolated parts
|
solid_cents_num.append(np.max([len(cents) - len(val_parts_iso), 2]))
|
else:
|
solid_cents_num.append(len(cents))
|
cents = np.concatenate(cents, axis=0)
|
cents_lists.append(cents)
|
cents_tosave = {}
|
count = 0
|
for ol_code in overlap_lists.keys():
|
cent_ = cents_lists[count]
|
if cent_.shape[0] < 2 or cent_.shape[0] > parts_upbd or cent_.shape[0] < parts_lobd:
|
pass
|
elif count > 0:
|
cent_1 = cents_lists[count-1]
|
if cent_.shape[0]==cent_1.shape[0] and np.sum(np.abs(cent_1-cent_)) < 1e-6:
|
pass
|
else:
|
cents_tosave[ol_code] = cent_
|
cents_tosave[ol_code + '_sol'] = np.array([solid_cents_num[count]])
|
else:
|
cents_tosave[ol_code] = cent_
|
cents_tosave[ol_code + '_sol'] = np.array([solid_cents_num[count]])
|
count += 1
|
# in case no result meet the restrictions
|
if len(cents_tosave) < 1:
|
count = 0
|
for ol_code in overlap_lists.keys():
|
cent_ = cents_lists[count]
|
if cent_.shape[0] < 2:
|
pass
|
elif count > 0:
|
cent_1 = cents_lists[count-1]
|
if cent_.shape[0]==cent_1.shape[0] and np.sum(np.abs(cent_1-cent_)) < 1e-6:
|
pass
|
else:
|
cents_tosave[ol_code] = cent_
|
cents_tosave[ol_code + '_sol'] = np.array([solid_cents_num[count]])
|
else:
|
cents_tosave[ol_code] = cent_
|
cents_tosave[ol_code + '_sol'] = np.array([solid_cents_num[count]])
|
count += 1
|
np.savez(os.path.join('output', renderdir, name, 'sam_cents.npz'), **cents_tosave)
|
# <FILESEP>
|
#!/usr/bin/python
|
# -*- coding: utf-8 -*-
|
import tensorflow as tf
|
class TCNNConfig(object):
|
"""CNN配置参数"""
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.