Skip to content

Commit

Permalink
new version for static datas
Browse files Browse the repository at this point in the history
  • Loading branch information
kapoorlab committed Jun 4, 2022
1 parent d178758 commit 09ec040
Show file tree
Hide file tree
Showing 7 changed files with 39 additions and 455 deletions.
448 changes: 13 additions & 435 deletions Notebooks/MIDOG_oneat_training_data_creator.ipynb

Large diffs are not rendered by default.

26 changes: 13 additions & 13 deletions Notebooks/parasitic_training_data_creator.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -73,15 +73,7 @@
"metadata": {
"scrolled": false
},
"outputs": [
{
"name": "stderr",
"output_type": "stream",
"text": [
" 4%|██▊ | 460/12489 [00:08<04:23, 45.71it/s]"
]
}
],
"outputs": [],
"source": [
"for root, dirs, files in os.walk(data_folder):\n",
" if dirs!=[]: \n",
Expand All @@ -93,18 +85,26 @@
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 4,
"id": "ba5f3a93",
"metadata": {},
"outputs": [],
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"(24998, 128, 128, 3) (24998, 2, 1)\n"
]
}
],
"source": [
"MovieCreator.createNPZ(save_dir, axes = 'SXYC', save_name = npz_name, save_name_val = npz_val_name)"
"MovieCreator.createNPZ(save_dir, axes = 'SXYC', save_name = npz_name, save_name_val = npz_val_name, expand = False, flip_channel_axis = True)"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "c9c968c4",
"id": "d2e1001d",
"metadata": {},
"outputs": [],
"source": []
Expand Down
15 changes: 10 additions & 5 deletions oneat/NEATUtils/MovieCreator.py
Original file line number Diff line number Diff line change
Expand Up @@ -792,7 +792,7 @@ def SegFreeImageLabelDataSet(image_dir, csv_dir,save_dir, static_name, static_la
SegFreeImageMaker(t, y[key], x[key], image, crop_size, gridx, gridy, offset, total_categories, trainlabel, name + event_name + str(count), save_dir)
count = count + 1

def createNPZ(save_dir, axes, save_name = 'Yolov0oneat', save_name_val = 'Yolov0oneatVal', static = False):
def createNPZ(save_dir, axes, save_name = 'Yolov0oneat', save_name_val = 'Yolov0oneatVal', expand = True, static = False, flip_channel_axis = False):

data = []
label = []
Expand All @@ -805,8 +805,9 @@ def createNPZ(save_dir, axes, save_name = 'Yolov0oneat', save_name_val = 'Yolov0
names = [Readname(fname) for fname in files_raw]
#Normalize everything before it goes inside the training
for i in range(0,len(NormalizeImages)):

n = NormalizeImages[i]

blankX = n
csvfname = save_dir + '/' + names[i] + '.csv'
arr = []
Expand All @@ -816,19 +817,23 @@ def createNPZ(save_dir, axes, save_name = 'Yolov0oneat', save_name_val = 'Yolov0
arr = np.array(arr)

blankY = arr

blankY = np.expand_dims(blankY, -1)
blankX = np.expand_dims(blankX, -1)

if expand:

blankX = np.expand_dims(blankX, -1)

data.append(blankX)
label.append(blankY)



dataarr = np.asarray(data)
labelarr = np.asarray(label)
if flip_channel_axis:
np.swapaxes(dataarr, 1,-1)
if static:
try:

dataarr = dataarr[:,0,:,:,:]
except:

Expand Down
Binary file modified oneat/NEATUtils/__pycache__/MovieCreator.cpython-39.pyc
Binary file not shown.
1 change: 1 addition & 0 deletions oneat/_version.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
__version__= '2.7.8'
2 changes: 1 addition & 1 deletion oneat/version.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
__version__= '2.7.7'
__version__= '2.7.8'
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

with open('README.md') as f:
long_description = f.read()
with open(path.join(_dir,'oneat','version.py'), encoding="utf-8") as f:
with open(path.join(_dir,'oneat','_version.py'), encoding="utf-8") as f:
exec(f.read())

setup(
Expand Down

0 comments on commit 09ec040

Please sign in to comment.