Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Docs #102

Merged
merged 12 commits into from
Feb 22, 2024
Merged

Docs #102

Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions docs/Tutorials.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
Tutorials
========================================================================================

These notebooks serve as a tutorial for the core aspects of Deepdisc.

.. toctree::

Installation <Tutorials/Installation>
Preprocesing <Tutorials/Preprocessing>
Understanding Deepdisc Configs <Tutorials/configs>
Loading Data with Deepdisc <Tutorials/data_loading>
Training with Deepdisc <Tutorials/training>
Predictions with Deepdisc <Tutorials/predictions>
41 changes: 41 additions & 0 deletions docs/Tutorials/Preprocessing.ipynb
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
{
"cells": [
{
"cell_type": "markdown",
"id": "04413870-779a-4fef-9eaa-76233ccdcbaf",
"metadata": {},
"source": [
"# Preprocessing"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "40d97c38-22c5-49e9-b849-e40fbd2ed1a8",
"metadata": {},
"outputs": [],
"source": []
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 3 (ipykernel)",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.9.18"
}
},
"nbformat": 4,
"nbformat_minor": 5
}
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -15,21 +15,28 @@
],
"metadata": {
"kernelspec": {
"display_name": "Python 3",
"display_name": "Python 3 (ipykernel)",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"version": "3.8.9"
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.9.18"
},
"orig_nbformat": 4,
"vscode": {
"interpreter": {
"hash": "31f2aee4e71d21fbe5cf8b01ff0e069b9275f58929596ceb00d14d90e3e16cd6"
}
}
},
"nbformat": 4,
"nbformat_minor": 2
"nbformat_minor": 4
}
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
{
"cells": [
{
"attachments": {},
"cell_type": "markdown",
"metadata": {},
"source": [
Expand All @@ -11,26 +10,42 @@
{
"cell_type": "markdown",
"metadata": {},
"source": [
"test"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": []
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 3",
"display_name": "Python 3 (ipykernel)",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"version": "3.8.9"
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.9.18"
},
"orig_nbformat": 4,
"vscode": {
"interpreter": {
"hash": "31f2aee4e71d21fbe5cf8b01ff0e069b9275f58929596ceb00d14d90e3e16cd6"
}
}
},
"nbformat": 4,
"nbformat_minor": 2
"nbformat_minor": 4
}
37 changes: 37 additions & 0 deletions docs/Tutorials/training.ipynb
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
{
"cells": [
{
"cell_type": "markdown",
"metadata": {},
"source": [
"# Training with Deepdisc "
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": []
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 3 (ipykernel)",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.9.18"
}
},
"nbformat": 4,
"nbformat_minor": 4
}
2 changes: 1 addition & 1 deletion docs/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -47,4 +47,4 @@ Notes:

Home page <self>
API Reference <autoapi/index>
Notebooks <notebooks>
Tutorials <Tutorials>
11 changes: 0 additions & 11 deletions docs/notebooks.rst

This file was deleted.

25 changes: 0 additions & 25 deletions docs/notebooks/training.ipynb

This file was deleted.

3 changes: 1 addition & 2 deletions src/deepdisc/astrodet/detectron.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
import detectron2.data as data
import detectron2.data.transforms as T

# Yufeng Dec21 more import
import matplotlib.pyplot as plt
import torch
from detectron2.data import build_detection_train_loader
Expand Down Expand Up @@ -391,7 +390,7 @@ def _setup_augs(self, augs, k: int):
if self.cropaug is None:
pass
else:
augl.insert(0, self.cropaug)
augl.insert(-1, self.cropaug)

return augl

Expand Down
4 changes: 2 additions & 2 deletions src/deepdisc/data_format/augment_image.py
Original file line number Diff line number Diff line change
Expand Up @@ -208,8 +208,8 @@ def dc2_train_augs(image):

],
k=-1,
#cropaug=None,
cropaug=T.RandomCrop("relative", (0.5, 0.5))
cropaug=None,
#cropaug=T.RandomCrop("relative", (0.5, 0.5))
)
return augs

Expand Down
6 changes: 4 additions & 2 deletions src/deepdisc/inference/match_objects.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,11 +77,13 @@ def get_object_coords(dataset_dict, outputs):
ys = []

for box in pred_boxes:
x,y = box[0], box[1]
w = box[2]-box[0]
h = box[3]-box[1]
x = box[0]+w//2
y = box[1]+h//2
xs.append(x)
ys.append(y)


coords = wcs.pixel_to_world(xs,ys)
ras = coords.ra.degree
decs = coords.dec.degree
Expand Down
10 changes: 5 additions & 5 deletions src/deepdisc/model/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -310,15 +310,15 @@ def _forward_redshift(self, features, instances):

fcs = self.redshift_conv(features)
pdfs = self.output_pdf(fcs)
zs = torch.tensor(np.linspace(0, 5, 200)).to(fcs.device)
zs = torch.tensor(np.linspace(0, 3, 300)).to(fcs.device)
nin = torch.as_tensor(np.array([num_instances_per_img]))
#probs = torch.zeros((num_instances_per_img[0], 200)).to(fcs.device)

inds = np.cumsum(num_instances_per_img)



probs = torch.zeros((torch.sum(nin), 200)).to(fcs.device)
probs = torch.zeros((torch.sum(nin), 300)).to(fcs.device)
for j, z in enumerate(zs):
probs[:, j] = pdfs.log_prob(z)

Expand Down Expand Up @@ -609,15 +609,15 @@ def _forward_redshift(self, features, instances):

fcs = self.redshift_fc(features)
pdfs = self.output_pdf(fcs)
zs = torch.tensor(np.linspace(0, 5, 200)).to(fcs.device)
zs = torch.tensor(np.linspace(0, 3, 300)).to(fcs.device)
nin = torch.as_tensor(np.array([num_instances_per_img]))
#probs = torch.zeros((num_instances_per_img[0], 200)).to(fcs.device)

inds = np.cumsum(num_instances_per_img)



probs = torch.zeros((torch.sum(nin), 200)).to(fcs.device)
probs = torch.zeros((torch.sum(nin), 300)).to(fcs.device)
for j, z in enumerate(zs):
probs[:, j] = pdfs.log_prob(z)

Expand Down Expand Up @@ -762,7 +762,7 @@ def _forward_redshift(self, features, instances):

fcs = self.redshift_fc(features)
pdfs = self.output_pdf(fcs)
zs = torch.tensor(np.linspace(0, 5, 200)).to(fcs.device)
zs = torch.tensor(np.linspace(-1, 5, 200)).to(fcs.device)
nin = torch.as_tensor(np.array([num_instances_per_img]))
#probs = torch.zeros((num_instances_per_img[0], 200)).to(fcs.device)

Expand Down
Loading