Skip to content
Snippets Groups Projects
Commit 30b57ab2 authored by Chris MacLellan's avatar Chris MacLellan
Browse files

moving files to support creation of python package

parent 0fe11128
Branches
Tags
No related merge requests found
The MIT License (MIT)
Copyright (c) 2021 Christopher J. MacLellan
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
Sparse Coding Library for PyTorch
=================================
\ No newline at end of file
File moved
File moved
File moved
File moved
[metadata]
name = sparse_coding_torch
author = Christopher J. MacLellan
author-email = christopher.maclellan@drexel.edu
summary = A library for doing sparse coding using PyTorch
description-file = README.rst
description-content-type = text/x-rst; charset=UTF-8
home-page = https://gitlab.cci.drexel.edu/teachable-ai-lab/sparse_coding_torch
project_urls =
Documentation = https://gitlab.cci.drexel.edu/teachable-ai-lab/sparse_coding_torch
Source Code = https://gitlab.cci.drexel.edu/teachable-ai-lab/sparse_coding_torch
license = MIT
license_file = LICENSE.txt
classifier =
Development Status :: 4 - Beta
Intended Audience :: Science/Research
Topic :: Scientific/Engineering :: Artificial Intelligence
License :: OSI Approved :: MIT License
Programming Language :: Python
Programming Language :: Python :: 2
Programming Language :: Python :: 2.7
Programming Language :: Python :: 3
Programming Language :: Python :: 3.7
Programming Language :: Python :: Implementation :: PyPy
keywords = "machine-learning"
[files]
packages =
sparse_coding_torch
[bdist_wheel]
universal=1
[aliases]
test=pytest
from setuptools import setup
setup(
setup_requires=['pbr'],
pbr=True,
)
......@@ -68,6 +68,8 @@ class BamcPreprocessor(nn.Module):
y_coord_max = torch.max(torch.where(slice_frame != 0)[0])
y_coord_min = torch.min(torch.where(slice_frame != 0)[0])
print("height: {}".format(y_coord_max - y_coord_min))
s = slice_frame[y_coord_max-21:y_coord_max, :]
pred = self.scale_classifier(s.unsqueeze(0).unsqueeze(0).float())
......
File moved
......@@ -21,68 +21,14 @@ def load_balls_data(batch_size):
def load_bamc_data(batch_size):
video_path = "/shared_data/bamc_data"
scale = 0.401
# base_width = 1920
# base_height = 1080
# cropped_width = round(140/320 * base_width)
# cropped_height = round(140/180 * base_height)
base_width = 1440
base_height = 454
cropped_width = round(0.7 * base_width)
cropped_height = base_height
width = round(cropped_width * scale)
height = round(cropped_height * scale)
transforms = torchvision.transforms.Compose([torchvision.transforms.Grayscale(num_output_channels=1),
torchvision.transforms.CenterCrop(size=(cropped_width, cropped_height)),
torchvision.transforms.Resize(size=(width, height)),
MinMaxScaler(0, 255)])
dataset = VideoLoader(video_path, transform=transforms, num_frames=60)
targets = dataset.get_labels()
train_idx, test_idx = train_test_split(np.arange(len(targets)), test_size=0.2, shuffle=True, stratify=targets)
train_sampler = torch.utils.data.SubsetRandomSampler(train_idx)
test_sampler = torch.utils.data.SubsetRandomSampler(test_idx)
train_loader = torch.utils.data.DataLoader(dataset, batch_size=batch_size,
# shuffle=True,
sampler=train_sampler)
test_loader = torch.utils.data.DataLoader(dataset, batch_size=batch_size,
# shuffle=True,
sampler=test_sampler)
return train_loader, test_loader
def load_bamc_data2(batch_size):
video_path = "/shared_data/cropped_pleural_lines/"
scale = 0.401
# base_width = 1920
# base_height = 1080
# cropped_width = round(140/320 * base_width)
# cropped_height = round(140/180 * base_height)
base_width = 1440
base_height = 454
cropped_width = round(0.7 * base_width)
cropped_height = base_height
width = round(cropped_width * scale)
height = round(cropped_height * scale)
transforms = torchvision.transforms.Compose([torchvision.transforms.Grayscale(num_output_channels=1),
torchvision.transforms.CenterCrop(size=(cropped_width, cropped_height)),
torchvision.transforms.Resize(size=(width, height)),
MinMaxScaler(0, 255)])
width = 350
height = 200
transforms = torchvision.transforms.Compose([VideoGrayScaler(),
MinMaxScaler(0, 255),
BamcPreprocessor(),
torchvision.transforms.Resize(size=(height, width))
])
dataset = VideoLoader(video_path, transform=transforms, num_frames=60)
targets = dataset.get_labels()
......
File moved
File moved
File moved
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment