Search is not available for this dataset
repo stringlengths 2 152 ⌀ | file stringlengths 15 239 | code stringlengths 0 58.4M | file_length int64 0 58.4M | avg_line_length float64 0 1.81M | max_line_length int64 0 12.7M | extension_type stringclasses 364
values |
|---|---|---|---|---|---|---|
kserve | kserve-master/tools/tf2openapi/generated/framework/tensor_slice.pb.go | // Code generated by protoc-gen-go. DO NOT EDIT.
// source: tensorflow/core/framework/tensor_slice.proto
package framework
import (
fmt "fmt"
proto "github.com/golang/protobuf/proto"
math "math"
)
// Reference imports to suppress errors if they are not otherwise used.
var _ = proto.Marshal
var _ = fmt.Errorf
var ... | 6,903 | 38.451429 | 116 | go |
kserve | kserve-master/tools/tf2openapi/generated/framework/types.pb.go | // Code generated by protoc-gen-go. DO NOT EDIT.
// source: tensorflow/core/framework/types.proto
package framework
import (
fmt "fmt"
proto "github.com/golang/protobuf/proto"
math "math"
)
// Reference imports to suppress errors if they are not otherwise used.
var _ = proto.Marshal
var _ = fmt.Errorf
var _ = mat... | 8,624 | 36.176724 | 96 | go |
kserve | kserve-master/tools/tf2openapi/generated/framework/variable.pb.go | // Code generated by protoc-gen-go. DO NOT EDIT.
// source: tensorflow/core/framework/variable.proto
package framework
import (
fmt "fmt"
proto "github.com/golang/protobuf/proto"
math "math"
)
// Reference imports to suppress errors if they are not otherwise used.
var _ = proto.Marshal
var _ = fmt.Errorf
var _ = ... | 8,501 | 37.470588 | 151 | go |
kserve | kserve-master/tools/tf2openapi/generated/framework/versions.pb.go | // Code generated by protoc-gen-go. DO NOT EDIT.
// source: tensorflow/core/framework/versions.proto
package framework
import (
fmt "fmt"
proto "github.com/golang/protobuf/proto"
math "math"
)
// Reference imports to suppress errors if they are not otherwise used.
var _ = proto.Marshal
var _ = fmt.Errorf
var _ = ... | 4,479 | 36.966102 | 138 | go |
kserve | kserve-master/tools/tf2openapi/generated/lib/core/error_codes.pb.go | // Code generated by protoc-gen-go. DO NOT EDIT.
// source: tensorflow/core/lib/core/error_codes.proto
package core
import (
fmt "fmt"
proto "github.com/golang/protobuf/proto"
math "math"
)
// Reference imports to suppress errors if they are not otherwise used.
var _ = proto.Marshal
var _ = fmt.Errorf
var _ = mat... | 10,854 | 44.801688 | 98 | go |
kserve | kserve-master/tools/tf2openapi/generated/protobuf/meta_graph.pb.go | // Code generated by protoc-gen-go. DO NOT EDIT.
// source: tensorflow/core/protobuf/meta_graph.proto
package protobuf
import (
fmt "fmt"
proto "github.com/golang/protobuf/proto"
any "github.com/golang/protobuf/ptypes/any"
framework "github.com/kserve/kserve/tools/tf2openapi/generated/framework"
math "math"
)
/... | 41,605 | 37.884112 | 231 | go |
kserve | kserve-master/tools/tf2openapi/generated/protobuf/saved_model.pb.go | // Code generated by protoc-gen-go. DO NOT EDIT.
// source: tensorflow/core/protobuf/saved_model.proto
package protobuf
import (
fmt "fmt"
proto "github.com/golang/protobuf/proto"
math "math"
)
// Reference imports to suppress errors if they are not otherwise used.
var _ = proto.Marshal
var _ = fmt.Errorf
var _ =... | 4,255 | 40.72549 | 168 | go |
kserve | kserve-master/tools/tf2openapi/generated/protobuf/saver.pb.go | // Code generated by protoc-gen-go. DO NOT EDIT.
// source: tensorflow/core/protobuf/saver.proto
package protobuf
import (
fmt "fmt"
proto "github.com/golang/protobuf/proto"
math "math"
)
// Reference imports to suppress errors if they are not otherwise used.
var _ = proto.Marshal
var _ = fmt.Errorf
var _ = math.... | 7,903 | 40.382199 | 206 | go |
kserve | kserve-master/tools/tf2openapi/generator/generate.go | package generator
import (
"fmt"
"github.com/getkin/kin-openapi/openapi3"
pb "github.com/kserve/kserve/tools/tf2openapi/generated/protobuf"
"github.com/kserve/kserve/tools/tf2openapi/types"
)
const (
DefaultSigDefKey = "serving_default"
DefaultTag = "serve"
)
// Known error messages
const (
SpecGenerat... | 2,394 | 25.032609 | 128 | go |
kserve | kserve-master/tools/tf2openapi/generator/generate_test.go | package generator
import (
"bytes"
"context"
"encoding/json"
"fmt"
"net/http"
"os"
"path/filepath"
"testing"
"github.com/getkin/kin-openapi/openapi3"
"github.com/getkin/kin-openapi/openapi3filter"
"github.com/getkin/kin-openapi/routers/legacy"
"github.com/golang/protobuf/proto"
"github.com/onsi/gomega"
... | 10,033 | 30.258567 | 114 | go |
kserve | kserve-master/tools/tf2openapi/generator/tensorflow_serving_protocol.go | package generator
import (
"fmt"
"github.com/golang/protobuf/proto"
"github.com/getkin/kin-openapi/openapi3"
"github.com/kserve/kserve/tools/tf2openapi/types"
)
const (
requestName = "modelInput"
responseName = "modelOutput"
requestRefTemplate = "#/components/requestBodies/%s"
responseRefTemp... | 1,655 | 24.875 | 85 | go |
kserve | kserve-master/tools/tf2openapi/types/tfdtype.go | package types
import (
"fmt"
"github.com/getkin/kin-openapi/openapi3"
"strings"
)
type TFDType int
const (
// all the possible constants that can be JSON-ified according to
// https://www.tensorflow.org/tfx/serving/api_rest#json_mapping
// along with a representation for B64 strings
DtBool TFDType = iota
DtB... | 2,178 | 24.635294 | 101 | go |
kserve | kserve-master/tools/tf2openapi/types/tfdtype_test.go | package types
import (
"fmt"
"github.com/getkin/kin-openapi/openapi3"
"github.com/onsi/gomega"
"testing"
)
func TestCreateTFDTypeTypical(t *testing.T) {
g := gomega.NewGomegaWithT(t)
tfDType, err := NewTFDType("tensor_name", "DT_STRING")
expectedTFDType := DtString
g.Expect(tfDType).Should(gomega.Equal(expect... | 1,502 | 25.368421 | 80 | go |
kserve | kserve-master/tools/tf2openapi/types/tfmetagraph.go | package types
/**
TFMetaGraph contains meta information about the TensorFlow graph, i.e. the signature definitions of the graph.
It is the internal model representation for the MetaGraph defined in the TensorFlow repository
[tensorflow/core/protobuf/meta_graph.proto]
*/
import (
"fmt"
"github.com/getkin/kin-openapi... | 1,401 | 28.208333 | 110 | go |
kserve | kserve-master/tools/tf2openapi/types/tfmetagraph_test.go | package types
import (
"fmt"
"github.com/kserve/kserve/pkg/utils"
"testing"
"github.com/getkin/kin-openapi/openapi3"
"github.com/kserve/kserve/tools/tf2openapi/generated/framework"
pb "github.com/kserve/kserve/tools/tf2openapi/generated/protobuf"
"github.com/onsi/gomega"
)
/* Expected values */
func expectedT... | 6,396 | 22.869403 | 94 | go |
kserve | kserve-master/tools/tf2openapi/types/tfsavedmodel.go | package types
/**
TFSavedModel is the high level serialization format for TensorFlow saved models.
It is the internal model representation for the SavedModel defined in the TensorFlow repository
[tensorflow/core/protobuf/saved_model.proto]
*/
import (
"fmt"
"sort"
"github.com/getkin/kin-openapi/openapi3"
"github.... | 1,441 | 24.298246 | 117 | go |
kserve | kserve-master/tools/tf2openapi/types/tfsavedmodel_test.go | package types
import (
"fmt"
"github.com/kserve/kserve/pkg/utils"
"testing"
"github.com/getkin/kin-openapi/openapi3"
"github.com/kserve/kserve/tools/tf2openapi/generated/framework"
pb "github.com/kserve/kserve/tools/tf2openapi/generated/protobuf"
"github.com/onsi/gomega"
)
/* Expected values */
func expectedT... | 5,069 | 26.112299 | 114 | go |
kserve | kserve-master/tools/tf2openapi/types/tfsignaturedef.go | package types
/**
TFSignatureDef defines the signature of supported computations in the TensorFlow graph, including their inputs and
outputs. It is the internal model representation for the SignatureDef defined in the TensorFlow repository
[tensorflow/core/protobuf/meta_graph.proto]
*/
import (
"errors"
"fmt"
"git... | 5,986 | 28.492611 | 144 | go |
kserve | kserve-master/tools/tf2openapi/types/tfsignaturedef_test.go | package types
import (
"fmt"
"testing"
"github.com/getkin/kin-openapi/openapi3"
"github.com/onsi/gomega"
"github.com/kserve/kserve/pkg/utils"
"github.com/kserve/kserve/tools/tf2openapi/generated/framework"
pb "github.com/kserve/kserve/tools/tf2openapi/generated/protobuf"
)
/* Expected values */
func expected... | 14,387 | 24.197898 | 108 | go |
kserve | kserve-master/tools/tf2openapi/types/tftensor.go | package types
/**
TFTensor represents a logical tensor. It contains the information from TensorInfo in the TensorFlow repository
[tensorflow/core/protobuf/meta_graph.proto] but is named after the user-facing input/output (hence being a logical
tensor and not an actual tensor).
*/
import (
"github.com/getkin/kin-opena... | 2,556 | 25.915789 | 128 | go |
kserve | kserve-master/tools/tf2openapi/types/tftensor_test.go | package types
import (
"fmt"
"testing"
"github.com/getkin/kin-openapi/openapi3"
"github.com/kserve/kserve/tools/tf2openapi/generated/framework"
pb "github.com/kserve/kserve/tools/tf2openapi/generated/protobuf"
"github.com/onsi/gomega"
)
/* Expected values */
func expectedTFTensor() TFTensor {
return TFTensor{... | 7,173 | 24.349823 | 86 | go |
null | ClustSeg-main/README.md | # ClustSeg
The code will release soon.
| 40 | 9.25 | 27 | md |
null | segodsidb-main/README.md | Introduction
------------
This repository contains **code** and **data** related to the paper:
**Hyperspectral image segmentation: A preliminary study on the Oral and Dental Spectral Image Database (ODSI-DB)** <br>[Luis Carlos Garcia Peraza Herrera](https://scholar.google.com/citations?user=R-sjuV4AAAAJ), [Conor Horga... | 10,486 | 34.914384 | 650 | md |
null | segodsidb-main/setup.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import setuptools
import unittest
# Read the contents of the README file
from os import path
this_directory = path.abspath(path.dirname(__file__))
with open(path.join(this_directory, 'README.md'), encoding='utf-8') as f:
long_description = f.read()
setuptools.setup(na... | 1,699 | 28.310345 | 73 | py |
null | segodsidb-main/config_templates/segmentation/odsi_db/README.md | 1 | 0 | 0 | md | |
null | segodsidb-main/data/README.md | 1 | 0 | 0 | md | |
null | segodsidb-main/src/__init__.py | from .config import *
from .logger import *
from .machine import *
from .utils import *
| 88 | 16.8 | 22 | py |
null | segodsidb-main/src/compute_all_hyper_400_1000_204_mean.py | """
@brief Compute the channel mean of the 204 interpolated bands from
400-1000nm. This script handles hyperspectral images from both
cameras, Nuance EX (450-950nm) and Specim IQ (400-1000nm).
@details The channels of both cameras are interpolated to a fixed range
define as:
np... | 5,821 | 30.989011 | 80 | py |
null | segodsidb-main/src/compute_all_hyper_400_1000_204_std.py | """
@brief Compute the channel std of the 204 interpolated bands from
400-1000nm.
@author Luis Carlos Garcia Peraza Herrera (luiscarlos.gph@gmail.com).
@date 8 Jul 2022.
"""
import argparse
import numpy as np
import os
import ntpath
import shutil
import tqdm
import cv2
import sys
# My imports
import t... | 5,487 | 29.831461 | 78 | py |
null | segodsidb-main/src/compute_all_hyper_450_950_170_mean.py | """
@brief Compute the channel mean of the 170 interpolated bands from
450-950nm.
@author Luis Carlos Garcia Peraza Herrera (luiscarlos.gph@gmail.com).
@date 21 Jun 2022.
"""
import argparse
import numpy as np
import os
import ntpath
import shutil
import tqdm
import cv2
import sys
# My imports
import... | 3,964 | 27.941606 | 80 | py |
null | segodsidb-main/src/compute_all_hyper_450_950_170_std.py | """
@brief Compute the channel std of the 170 interpolated bands from
450-950nm.
@author Luis Carlos Garcia Peraza Herrera (luiscarlos.gph@gmail.com).
@date 21 Jun 2022.
"""
import argparse
import numpy as np
import os
import ntpath
import shutil
import tqdm
import cv2
import sys
# My imports
import t... | 4,318 | 28.380952 | 78 | py |
null | segodsidb-main/src/compute_all_hyper_450_950_51_mean.py | """
@brief Compute the channel mean of the 51 interpolated bands from
450-950nm.
@author Luis Carlos Garcia Peraza Herrera (luiscarlos.gph@gmail.com).
@date 21 Jun 2022.
"""
import argparse
import numpy as np
import os
import ntpath
import shutil
import tqdm
import cv2
import sys
# My imports
import ... | 3,960 | 27.912409 | 80 | py |
null | segodsidb-main/src/compute_all_hyper_450_950_51_std.py | """
@brief Compute the channel std of the 51 interpolated bands from
450-950nm.
@author Luis Carlos Garcia Peraza Herrera (luiscarlos.gph@gmail.com).
@date 21 Jun 2022.
"""
import argparse
import numpy as np
import os
import ntpath
import shutil
import tqdm
import cv2
import sys
# My imports
import to... | 4,314 | 28.353741 | 78 | py |
null | segodsidb-main/src/compute_class_loss_weights.py | """
@brief Compute the weights for each class of the ODSI-DB dataset based on the
number of pixels of each class.
@author Luis Carlos Garcia Peraza Herrera (luiscarlos.gph@gmail.com).
@date 21 Jun 2022.
"""
# My imports
import torchseg.data_loader as dl
pixels_per_class = {
u'Skin': ... | 3,193 | 32.621053 | 90 | py |
null | segodsidb-main/src/compute_nuance_ex_mean.py | """
@brief Compute the channel mean of the Nuance EX images.
@author Luis Carlos Garcia Peraza Herrera (luiscarlos.gph@gmail.com).
@date 16 Feb 2022.
"""
import argparse
import numpy as np
import os
import ntpath
import shutil
import tqdm
import cv2
import sys
# My imports
import torchseg.data_loader as dl
imp... | 3,875 | 27.086957 | 80 | py |
null | segodsidb-main/src/compute_nuance_ex_std.py | """
@brief Compute the channel std of the Nuance EX images.
@author Luis Carlos Garcia Peraza Herrera (luiscarlos.gph@gmail.com).
@date 16 Feb 2022.
"""
import argparse
import numpy as np
import os
import ntpath
import shutil
import tqdm
import cv2
import sys
# My imports
import torchseg.data_loader as dl
impo... | 4,104 | 27.706294 | 80 | py |
null | segodsidb-main/src/compute_pixel_stats.py | """
@brief Script that computes iteratively the mean and unbiased sample
standard deviation.
@author Luis Carlos Garcia Peraza Herrera (luiscarlos.gph@gmail.com).
@date 15 Dec 2021.
"""
import argparse
import numpy as np
import os
import copy
import tqdm
#import random
#import pandas as pd
#import sea... | 4,349 | 28.794521 | 80 | py |
null | segodsidb-main/src/compute_rgb_mean.py | """
@brief Compute the RGB channel mean of the ODSI-DB reconstructed images.
@author Luis Carlos Garcia Peraza Herrera (luiscarlos.gph@gmail.com).
@date 16 Feb 2022.
"""
import argparse
import numpy as np
import os
import ntpath
import shutil
import tqdm
import cv2
# My imports
import torchseg.data_loader as d... | 3,891 | 27.617647 | 80 | py |
null | segodsidb-main/src/compute_rgb_std.py | """
@brief Compute the std of the RGB images in the ODSI-DB dataset,
normalised to the range [0, 1].
@author Luis Carlos Garcia Peraza Herrera (luiscarlos.gph@gmail.com).
@date 16 Feb 2022.
"""
import argparse
import numpy as np
import os
import ntpath
import shutil
import tqdm
import cv2
# My imports... | 4,390 | 29.282759 | 80 | py |
null | segodsidb-main/src/compute_specim_iq_mean.py | """
@brief Compute the channel mean of the Specim IQ images.
@author Luis Carlos Garcia Peraza Herrera (luiscarlos.gph@gmail.com).
@date 16 Feb 2022.
"""
import argparse
import numpy as np
import os
import ntpath
import shutil
import tqdm
import cv2
import sys
# My imports
import torchseg.data_loader as dl
imp... | 3,733 | 26.659259 | 80 | py |
null | segodsidb-main/src/compute_specim_iq_std.py | """
@brief Compute the channel std of the Specim IQ images.
@author Luis Carlos Garcia Peraza Herrera (luiscarlos.gph@gmail.com).
@date 16 Feb 2022.
"""
import argparse
import numpy as np
import os
import ntpath
import shutil
import tqdm
import cv2
import sys
# My imports
import torchseg.data_loader as dl
impo... | 4,105 | 27.713287 | 80 | py |
null | segodsidb-main/src/generate_odsi_db_split.py | """
@brief Script that generates a convenient split of training and testing
images for the ODSI-DB dataset. Then you can split the training fold
into training and validation however you want, but this is expected to
be done in your dataloader.
@details A convenient dataset must have at le... | 16,274 | 34.927152 | 82 | py |
null | segodsidb-main/src/generate_results_latex.py | """
@brief Script that generates a Latex table where every row represents a class
and every column represents a cross-validation fold. The cells will
contain the metric, which for ODSI-DB we have decided will be balanced
accuracy.
@author Luis Carlos Garcia Peraza Herrera (luiscarlos.gph@... | 5,686 | 30.41989 | 98 | py |
null | segodsidb-main/src/generate_rgb_recon.py | """
@brief Script that reconstructs the RGB images of the ODSI-DB dataset and
saves them in output folders, one per camera.
- Nuance EX (1392x1040 pixels, 450-950nm, 10nm steps).
- Specim IQ (512x512 pixels, 400-1000nm, 3nm steps).
@author Luis Carlos Garcia Peraza Herrera (luiscarlos.gp... | 4,659 | 32.52518 | 93 | py |
null | segodsidb-main/src/generate_tsne.py | """
@brief Script that generates a t-SNE of all the pixels in the ODSI-DB dataset,
comparing RGB pixels with hyperspectral pixels.
@author Luis Carlos Garcia Peraza Herrera (luiscarlos.gph@gmail.com).
@date 27 Sep 2021.
"""
import argparse
import numpy as np
import os
import tqdm
import random
import p... | 20,785 | 42.668067 | 102 | py |
null | segodsidb-main/src/odsi_db_stats.py | """
@brief Script that show some ODSI-DB stats that are relevant for the paper:
- Number of images of 51 bands
- Number of images of 204 bands
- Number of pixels per class
- Number of images in which a class is annotated
@author Luis Carlos Garcia Peraza Herrera (luiscarlos.gph@g... | 5,669 | 31.4 | 97 | py |
null | segodsidb-main/src/produce_cmf_plot.py | #!/usr/bin/env python3
#
# @brief Script to produce HSI to XYZ conversion colour matching function.
#
# @author Luis C. Garcia Peraza Herrera (luiscarlos.gph@gmail.com).
# @date 23 Aug 2022.
import numpy as np
import seaborn as sns
import matplotlib.pyplot as plt
# My imports
import torchseg.data_loader as dl
... | 4,371 | 31.626866 | 135 | py |
null | segodsidb-main/src/split_images_per_camera_model.py | """
@brief Script that splits ODSI-DB dataset into two parts: images generated
by the Nuance EX (1392x1040 pixels, 450-950nm, 10nm steps) and the
Specim IQ (512x512 pixels, 400-1000nm, 3nm steps).
@author Luis Carlos Garcia Peraza Herrera (luiscarlos.gph@gmail.com).
@date 27 Sep 2021.
"""
imp... | 3,860 | 30.137097 | 82 | py |
null | segodsidb-main/src/test.py | """
@brief Main script to launch the testing process.
@author Luis Carlos Garcia Peraza Herrera (luiscarlos.gph@gmail.com).
@date 5 Jun 2021.
"""
import argparse
import collections
import torch
import numpy as np
import tqdm
import json
import cv2
import skimage.color
# My imports
import torchseg.config.parser
imp... | 13,865 | 34.92228 | 100 | py |
null | segodsidb-main/src/train.py | """
@brief Main script to kick off the training.
@author Luis Carlos Garcia Peraza Herrera (luiscarlos.gph@gmail.com).
@date 1 Jun 2021.
"""
import argparse
import collections
import torch
import numpy as np
# My imports
import torchseg.config.parser
import torchseg.data_loader
import torchseg.model
import torchs... | 4,439 | 34.238095 | 95 | py |
null | segodsidb-main/src/validate_class_presence.py | """
@brief We want to use image-level annotations to learn the segmentation.
Therefore, we need to make sure that there is at least one image
(ideally more) where each of the classes is not present.
The opposite is not a concern, as we know that all the classes are
presen... | 4,147 | 30.664122 | 93 | py |
null | segodsidb-main/src/validate_dataset.py | """
@brief Script to validate the hyperspectral data of ODSI-DB along with the
generation of RGB images from hyperspectral data.
@author Luis Carlos Garcia Peraza Herrera (luiscarlos.gph@gmail.com).
@date 27 Sep 2021.
"""
import argparse
import numpy as np
import os
import tqdm
import random
import pan... | 4,126 | 29.57037 | 82 | py |
null | segodsidb-main/src/base/__init__.py | from .base_data_loader import *
from .base_model import *
from .base_machine import *
| 86 | 20.75 | 31 | py |
null | segodsidb-main/src/base/base_data_loader.py | """
@brief Module with the definition of the base data loader.
@author Luis Carlos Garcia Peraza Herrera (luiscarlos.gph@gmail.com).
@date 1 Jun 2021.
"""
import numpy as np
import torch
class BaseDataLoader(torch.utils.data.DataLoader):
def __init__(self, dataset, batch_size, shuffle, validation_split... | 3,185 | 32.893617 | 82 | py |
null | segodsidb-main/src/base/base_machine.py | """
@brief Module with base learning machine. This class is meant to control the
training and validation processes for a particular problem or task.
@author Luis Carlos Garcia Peraza Herrera (luiscarlos.gph@gmail.com).
@date 2 Jun 2021.
"""
import torch
import abc
import numpy as np
# My imports
import tor... | 6,879 | 37.651685 | 90 | py |
null | segodsidb-main/src/base/base_model.py | """
@brief Base class for deep learning models.
@author Luis Carlos Garcia Peraza Herrera (luiscarlos.gph@gmail.com).
@date 1 Jun 2021.
"""
import torch
import numpy as np
import abc
class BaseModel(torch.nn.Module):
"""
@brief Base class for all models.
"""
def from_file():
# TODO
... | 977 | 24.736842 | 79 | py |
null | segodsidb-main/src/config/__init__.py | from .parser import *
| 22 | 10.5 | 21 | py |
null | segodsidb-main/src/config/parser.py | """
@brief Module that contains the ConfigParser class. It is a lightweight module
to read the configuration file and the command line parameters and
combine them into a single place.
@details The code in this module was inspired by:
https://github.com/victoresque/pytorch-template
@autho... | 7,569 | 35.570048 | 82 | py |
null | segodsidb-main/src/data_loader/__init__.py | from .data_loader import *
from .tiff import *
| 47 | 15 | 26 | py |
null | segodsidb-main/src/data_loader/data_loader.py | """
@brief Collection of data loaders for different datasets.
@author Luis Carlos Garcia Peraza Herrera (luiscarlos.gph@gmail.com).
@date 2 Jun 2021.
"""
import os
import torch
import torchvision
import PIL
import numpy as np
import random
import colour
import scipy
import matplotlib.pyplot as plt
# My imports
imp... | 68,696 | 49.773836 | 120 | py |
null | segodsidb-main/src/data_loader/tiff.py | # Copyright © 2020 University of Eastern Finland
#
# 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, ... | 13,146 | 45.292254 | 115 | py |
null | segodsidb-main/src/logger/__init__.py | from .logger import *
| 22 | 10.5 | 21 | py |
null | segodsidb-main/src/logger/logger.py | """
@brief Module to setup and maintain the logging abilities of the training and
validation scripts.
@author Luis Carlos Garcia Peraza Herrera (luiscarlos.gph@gmail.com).
@date 1 Jun 2021.
"""
import logging
import logging.config
import pathlib
import torchseg.utils
class LoggerSetup():
def __init__(... | 1,055 | 33.064516 | 79 | py |
null | segodsidb-main/src/machine/__init__.py | from .machine import *
| 23 | 11 | 22 | py |
null | segodsidb-main/src/machine/machine.py | """
@brief Module that contains the learning machine for each problem/task.
@author Luis Carlos Garcia Peraza Herrera (luiscarlos.gph@gmail.com).
@date 2 Jun 2021.
"""
import numpy as np
import torch
import torchvision.utils
# My imports
import torchseg.base
import torchseg.utils
class GenericMachine(torchseg.ba... | 8,241 | 38.435407 | 96 | py |
null | segodsidb-main/src/model/__init__.py | from .model import *
from .loss import *
from .metric import *
| 63 | 15 | 21 | py |
null | segodsidb-main/src/model/loss.py | """
@brief Module that contains loss functions.
@author Luis Carlos Garcia Peraza Herrera (luiscarlos.gph@gmail.com).
@date 1 Jun 2021.
"""
import numpy as np
import sys
import torch
import monai.losses
def nll_loss(pred, gt):
"""
@brief Negative log-likelihood loss (also called multi-class cross entropy... | 6,327 | 37.120482 | 89 | py |
null | segodsidb-main/src/model/metric.py | """
@brief Module of evaluation measures or metrics.
@author Luis Carlos Garcia Peraza Herrera (luiscarlos.gph@gmail.com).
@date 2 Jun 2021.
"""
import torch
import numpy as np
import monai.metrics
import torchvision
# My imports
import torchseg.data_loader as dl
def accuracy(pred, gt):
"""
@brief Given... | 17,446 | 37.944196 | 82 | py |
null | segodsidb-main/src/model/model.py | """
@brief Collection of deep learning models.
@author Luis C. Garcia Peraza Herrera (luiscarlos.gph@gmail.com).
@date 4 Jun 2021.
"""
import torch
import torch.nn.functional as F
import torch.utils.model_zoo
import numpy as np
import monai.networks
import torchvision.models
import collections
import math
import u... | 23,154 | 38.446337 | 111 | py |
null | segodsidb-main/src/utils/__init__.py | from .utils import *
| 21 | 10 | 20 | py |
null | segodsidb-main/src/utils/utils.py | """
@brief Collection of functions for general purpose use.
@author Luis Carlos Garcia Peraza Herrera (luiscarlos.gph@gmail.com).
@date 1 Jun 2021.
"""
import os
import re
import pathlib
import json
import collections
import torch
import pandas as pd
## ----- Functions ----- ##
def read_json(fname):
"""@b... | 3,464 | 29.9375 | 82 | py |
null | segodsidb-main/src/visualization/__init__.py | from .visualization import *
| 29 | 14 | 28 | py |
null | segodsidb-main/src/visualization/visualization.py | """
@brief Module with classes for displaying, drawing and plotting information.
@author Luis Carlos Garcia Peraza Herrera (luiscarlos.gph@gmail.com).
@date 2 Jun 2021.
"""
import numpy as np
import importlib
import datetime
class TensorboardWriter():
def __init__(self, log_dir, logger, enabled):
self... | 3,424 | 35.827957 | 113 | py |
null | segodsidb-main/test/test_hyper2rgb.py | """
@brief Unit tests for the reconstruction of RGB images from hyperspectral data.
@author Luis Carlos Garcia Peraza Herrera (luiscarlos.gph@gmail.com).
@date 9 Feb 2022.
"""
import unittest
import numpy as np
import colour
import scipy
# My imports
import torchseg.data_loader
class TestReconstructionMethods(uni... | 1,182 | 27.166667 | 98 | py |
null | segodsidb-main/test/test_metric.py | """
@brief Unit tests for the reconstruction of RGB images from hyperspectral data.
@author Luis Carlos Garcia Peraza Herrera (luiscarlos.gph@gmail.com).
@date 9 Feb 2022.
"""
import unittest
import numpy as np
import colour
import scipy
# My imports
import torchseg.data_loader
class TestReconstructionMethods(uni... | 1,182 | 27.166667 | 98 | py |
null | CPTD-main/README.md | # Conformal Prediction Intervals with Temporal Dependence
This is the code associated with "Conformal Prediction Intervals with Temporal Dependence".
To replicate the (`Load`) experiments:
1. Train the base models: `python -m utils.main_experiments`
2. run `main.ipynb` for results
For other datasets, please download... | 560 | 39.071429 | 93 | md |
null | CPTD-main/_settings.py | import os
import getpass
import sys
_ON_SERVER = True
__CUR_FILE_PATH = os.path.dirname(os.path.abspath(__file__))
#==============================Data Related
COVID_NAME = 'COVID'
MIMIC_NAME = 'MIMIC'
EEG_NAME = 'EEG'
GEFCom_NAME = 'Load'
WORKSPACE = os.path.join(__CUR_FILE_PATH, "Temp")
DATA_PATH = os.path.join(... | 619 | 21.142857 | 67 | py |
null | CPTD-main/env.yml | name: cptd
channels:
- pytorch
- defaults
dependencies:
- anyio=3.5.0=py39haa95532_0
- argon2-cffi=21.3.0=pyhd3eb1b0_0
- argon2-cffi-bindings=21.2.0=py39h2bbff1b_0
- asttokens=2.0.5=pyhd3eb1b0_0
- attrs=21.4.0=pyhd3eb1b0_0
- babel=2.9.1=pyhd3eb1b0_0
- backcall=0.2.0=pyhd3eb1b0_0
- beautifulsoup4=4.1... | 5,633 | 31.566474 | 47 | yml |
null | CPTD-main/data/__init__.py | 0 | 0 | 0 | py | |
null | CPTD-main/data/online_dataset.py | import torch
from torch.utils.data import Dataset
import numpy as np
from _settings import COVID_NAME, MIMIC_NAME, GEFCom_NAME, EEG_NAME
HORIZON_LENGTHS = {MIMIC_NAME: 30, GEFCom_NAME: 24, COVID_NAME: 30, EEG_NAME: 63}
DEFAULT_NTESTS = {MIMIC_NAME: 100, COVID_NAME: 80, GEFCom_NAME: 700, EEG_NAME:200}
DEFAULT_NVALIDS ... | 3,982 | 34.882883 | 111 | py |
null | CPTD-main/data/preprocessing/__init__.py | 0 | 0 | 0 | py | |
null | CPTD-main/data/preprocessing/covid.py | import os.path
import numpy as np
import pandas as pd
from _settings import WORKSPACE, DATA_PATH
from data.online_dataset import get_split_idx, DatasetWrapperFull
COVID_ROOT = os.path.join(DATA_PATH, 'COVID')
def get_normalized_daily_counts(startdate='2022-03-01', enddate='2022-03-31'):
#Download the data from h... | 1,590 | 45.794118 | 122 | py |
null | CPTD-main/data/preprocessing/eeg.py | import gzip
import os
import pathlib
import pickle
import numpy as np
from scipy.signal import resample
from _settings import WORKSPACE, DATA_PATH
from data.online_dataset import get_split_idx, DatasetWrapperFull
EEG_ROOT = os.path.join(DATA_PATH, 'EEG')
eeg_root_train = os.path.join(EEG_ROOT, 'SMNI_CMI_TRAIN')
eeg_... | 3,534 | 40.104651 | 127 | py |
null | CPTD-main/data/preprocessing/gefc.py | import numpy as np
import pandas as pd
import os
from _settings import DATA_PATH, GEFCom_NAME
from data.online_dataset import DatasetWrapperFull
GEFC_ROOT = os.path.join(DATA_PATH, GEFCom_NAME)
from datetime import datetime
def read_data(sanity_check=False):
df = pd.read_csv(os.path.join(GEFC_ROOT, 'L1-train.csv... | 2,806 | 40.279412 | 128 | py |
null | CPTD-main/data/preprocessing/mimic.py | import pandas as pd
import torch
from _settings import WORKSPACE, DATA_PATH, MIMIC_NAME
import os, tqdm
from data.online_dataset import DatasetWrapperFull, get_split_idx
MIMIC_ROOT = os.path.join(DATA_PATH, 'MIMIC')
"""
--SQL Queries
SELECT distinct p1.subject_id
INTO mimiciii.target_patients_20220420
FROM mimicii... | 6,499 | 41.48366 | 258 | py |
null | CPTD-main/models/CPTD.py | import os
import torch
import numpy as np
class _PI_Constructor(torch.nn.Module):
def __init__(self, base_model_path=None, **kwargs):
super(_PI_Constructor, self).__init__()
self.base_model_path = base_model_path
assert os.path.isfile(self.base_model_path)
self.base_model = torch.lo... | 7,499 | 46.169811 | 147 | py |
null | CPTD-main/models/base_rnn.py | import torch
from models.training_utils import fit_mean, fit_resid, get_lengths_mask
class MyRNN(torch.nn.Module):
def __init__(self, embedding_size, input_size=1, output_size=1, horizon=1, rnn_mode="LSTM", path=None):
super(MyRNN, self).__init__()
self.input_size = input_size
self.embeddi... | 3,272 | 40.961538 | 112 | py |
null | CPTD-main/models/cqrnn.py | import torch
import numpy as np
class CQRNN(torch.nn.Module):
def __init__( self, base_model_path, alpha=0.1, **kwargs):
super(CQRNN, self).__init__()
self.qrnn = torch.load(base_model_path)
self.alpha = alpha
self._update_cal_loc = 0 # if we want to update the calibration residu... | 2,551 | 44.571429 | 137 | py |
null | CPTD-main/models/dprnn.py | # Adapted from https://github.com/kamilest/conformal-rnn/blob/master/models/dprnn.py
import torch
from scipy import stats as st
from torch import nn
import tqdm
from models.training_utils import get_lengths_mask
class DPRNN(nn.Module):
def __init__(
self,
rnn_mode="LSTM",
epochs=5,
... | 3,468 | 33.009804 | 116 | py |
null | CPTD-main/models/losses.py | import torch
def quantile_loss(output, target, masks, alpha):
single_loss = masks * quantile_noreduction_loss(output, target, alpha)
loss = torch.mean(torch.sum(single_loss, dim=1) / torch.sum(masks, dim=1))
return loss
def quantile_noreduction_loss(output, target,alpha):
return ((output - target) ... | 404 | 30.153846 | 113 | py |
null | CPTD-main/models/qrnn.py | # Adapted from https://github.com/kamilest/conformal-rnn/blob/master/models/qrnn.py
import torch
from models.losses import quantile_loss
from models.training_utils import get_lengths_mask
import tqdm
torch.manual_seed(1)
class QRNN(torch.nn.Module):
def __init__(
self,
rnn_mode="LSTM",
e... | 4,758 | 38.658333 | 137 | py |
null | CPTD-main/models/resid.py | import torch
import numpy as np
class LASplit(torch.nn.Module):
def __init__( self, base_model_path, alpha=0.1, **kwargs):
super(LASplit, self).__init__()
self.madrnn = torch.load(base_model_path, map_location=kwargs.get('device'))
self.alpha = alpha
self._update_cal_loc = 0 # if ... | 2,922 | 46.918033 | 140 | py |
null | CPTD-main/models/training_utils.py | import torch
import tqdm
def get_lengths_mask(sequences, lengths, horizon=None):
lengths_mask = torch.zeros_like(sequences, device=sequences.device)
for i, l in enumerate(lengths):
if horizon is not None: l = min(l, horizon)
lengths_mask[i, -l:, :] = 1
return lengths_mask
def fit_mean(self... | 5,298 | 47.614679 | 122 | py |
null | CPTD-main/utils/__init__.py | 0 | 0 | 0 | py | |
null | CPTD-main/utils/evaluate.py | import numpy as np
import pandas as pd
import torch
import tqdm
import matplotlib.pyplot as plt
from scipy.stats import median_absolute_deviation
#==============Simulation for the best case, where the even of "coverage" is temporally independent
def sim_ideal_coverage_one(T=20, p=0.9, N=1000, seed=0):
np.random.s... | 5,133 | 43.258621 | 145 | py |
null | CPTD-main/utils/main_experiments.py | import os
import pandas as pd
import torch
import models.base_rnn as base_rnn
import models.qrnn as qrnn
import models.dprnn as dprnn
from _settings import WORKSPACE, COVID_NAME, MIMIC_NAME, GEFCom_NAME, BASE_MODEL_PATH, EEG_NAME
import utils.evaluate as eval_utils
import utils.utils1 as utils
import data.online_datase... | 8,864 | 45.171875 | 218 | py |
null | CPTD-main/utils/utils1.py | import numpy as np
import os
import datetime
import _settings
import tqdm
LOG_FOLDER = _settings.LOG_OUTPUT_DIR
TODAY_STR = datetime.datetime.today().strftime('%Y%m%d')
def merge_dict_inline(d1,d2):
d1 = d1.copy()
d1.update(d2)
return d1
#========================
import logging
def get_logger(name=None... | 5,836 | 36.178344 | 166 | py |
tb3py | tb3py-master/CODEMETA.yaml | # NIST Opensource Portal repositories categories and themes.
# Source: https://www.nist.gov/topics
# Choose one catgeory and at least one theme as you think
# adequate for your opensource repository.
# Uncomment the category and the research
# themes that suit you best.
# You are also able to provide further details on... | 1,641 | 27.310345 | 70 | yaml |
tb3py | tb3py-master/LICENSE.md | # NIST DISCLAIMER
The following information applies to the software code developed
by employees of NIST.
Additional LICENSES are located within the code base and are provided by 3rd
party developers.
==============================================================================
This software was developed by employ... | 2,128 | 56.540541 | 172 | md |
tb3py | tb3py-master/README.md | 
[](https://codecov.io/gh/usnistgov/tb3py)

![GitHub tag (latest SemV... | 3,368 | 33.377551 | 190 | md |