This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import json | |
import base64 | |
import asyncio | |
import pyaudio | |
import websockets | |
SAMPLE_RATE=16000 | |
FRAMES_PER_BUFFER = 3200 | |
API_KEY = '<your AssemblyAI Key goes here>' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* QuPath script to threshold a single channel of an image. | |
* This can also be useful to convert a binary image into QuPath annotations. | |
* | |
* First written for https://forum.image.sc/t/rendering-wsi-as-overlay-on-top-of-another-wsi/52629/24?u=petebankhead | |
* | |
* @author Pete Bankhead | |
*/ | |
int channel = 0 // 0-based index for the channel to threshold |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from nonconformist.cp import IcpRegressor | |
from nonconformist.cp import IcpClassifier | |
from nonconformist.nc import NcFactory | |
import lightgbm as lgbm | |
# Create the underlying model | |
model = lgbm.LGBMRegressor() | |
# Default nonconformity measure | |
nc = NcFactory.create_nc(model) | |
# Inductive conformal regressor | |
icp = IcpRegressor(nc) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: CI | |
on: | |
push: | |
branches: | |
- master | |
pull_request: | |
branches: | |
- master | |
jobs: | |
build_web: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def f1_loss(y_true:torch.Tensor, y_pred:torch.Tensor, is_training=False) -> torch.Tensor: | |
'''Calculate F1 score. Can work with gpu tensors | |
The original implmentation is written by Michal Haltuf on Kaggle. | |
Returns | |
------- | |
torch.Tensor | |
`ndim` == 1. 0 <= val <= 1 | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import keras | |
from keras.applications.vgg16 import VGG16 | |
from keras.applications.vgg16 import preprocess_input, decode_predictions | |
from keras.preprocessing import image | |
import keras.backend as K | |
import tensorflow as tf | |
from tensorflow.python.framework import ops | |
import numpy as np |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# from the guide https://blog.keras.io/building-powerful-image-classification-models-using-very-little-data.html | |
# and from other resources found, trying to achieve a good classifier based on Inveption V3 pre-trained netfork | |
from keras.applications.inception_v3 import InceptionV3 | |
from keras.preprocessing import image | |
from keras.models import Model | |
from keras.layers import Dense, GlobalAveragePooling2D | |
from keras.preprocessing.image import ImageDataGenerator | |
from keras import backend as K | |
from keras.callbacks import ModelCheckpoint |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Scripts mostly taken from Pete, and also from the forums. For easy access and reference. | |
TOC | |
Alignment: Several scripts to assist in alignment as of M9. Store scripts make files using the Affine transformation while | |
TransferObjects uses the stored file in the Affine folder with the current image name to move objects into it. | |
The final result is that one set of files can be generated for the transforms, and those transforms can be accessed to move objects | |
back and forth between the images. | |
Change annotations into Cell objects.groovy - Converts annotations into PathCellObjects, which allows certian functions to work within |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Scripts mostly taken from Pete, and also from the forums. For easy access and reference. | |
Covers both Selecting, which is necessary to run most commands like cell detection, and collecting objects into a variable | |
for processing. The latter is more efficient when you do not need to run a command like cell detection. | |
TOC | |
A Selection guide.groovy - not actually a script, just a collection of useful tips. | |
Access top level objects.groovy - Creates a list of all objects at the "top" of the hierarchy. This list is dynamic. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Collections of scripts harvested mainly from Pete, but also picked up from the forums | |
TOC | |
Annotation subtraction example.groovy - An example of creating and subtracing ROIs through scripting | |
Create annotation of fixed size.groovy - see https://petebankhead.github.io/qupath/scripting/2018/03/09/script-create-fixed-size-region.html | |
Create object based on Viewer position.groovy - Creates an object at the Viewer position. In this case a rectangle. Useful if you want | |
to create the exact same size object multiple times and then move it to an area of interest for subsampling. |
NewerOlder