Skip to content

Instantly share code, notes, and snippets.

View IanButterworth's full-sized avatar

Ian Butterworth IanButterworth

View GitHub Profile
@IanButterworth
IanButterworth / spintest.jl
Created December 19, 2018 20:04
spintest
#Downsampled preview of image using non-copying interpolation method,
#to increase display FPS.
using Spinnaker, Makie, Random, ModernGL, ImageTransformations, Interpolations, Colors, FixedPointNumbers
function testvideo(frames)
trigmode = true
img = Array{UInt8}(undef, 2048, 1536)
@IanButterworth
IanButterworth / model.jl
Created January 6, 2019 20:18
ONNX.jl generated model.jl for tiny_yolov2 model
using Statistics
Mul(a,b,c) = b .* reshape(c, (1,1,size(c)[a],1))
Add(axis, A ,B) = A .+ reshape(B, (1,1,size(B)[1],1))
flipkernel(x) = x[end:-1:1, end:-1:1, :, :]
begin
c_1 = Conv(flipkernel(weights["convolution8_W"]), Float32[0.0], relu, stride=(1, 1), pad=(0, 0), dilation=(1, 1))
c_2 = BatchNorm(identity, weights["BatchNormalization_B7"], weights["BatchNormalization_scale7"], broadcast(Float32, weights["BatchNormalization_mean7"]), broadcast(Float32, broadcast(sqrt, broadcast(+, 1.0f-5, weights["BatchNormalization_variance7"]))), 1.0f-5, 0.0f0, false)
c_3 = Conv(flipkernel(weights["convolution7_W"]), Float32[0.0], relu, stride=(1, 1), pad=(1, 1), dilation=(1, 1))
c_4 = BatchNorm(identity, weights["BatchNormalization_B6"], weights["BatchNormalization_scale6"], broadcast(Float32, weights["BatchNormalization_mean6"]), broadcast(Float32, broadcast(sqrt, broadcast(+, 1.0f-5, weights["BatchNormalization_variance6"]))), 1.0f-5, 0.0f0, false)
c_5 = Conv(flipkernel(weights["convolution6_W"])
@IanButterworth
IanButterworth / gdb_output.txt
Created May 20, 2019 21:32
gdb error on MacOS Mojave - GCC 9.1.0
ian:VideoIO.jl ian$ cd /Users/ian/Documents/GitHub/VideoIO.jl
ian:VideoIO.jl ian$ gdb --args /Users/ian/Documents/GitHub/julia/usr/bin/julia-debug examples/encodevideo.jl
GNU gdb (GDB) 8.3
Copyright (C) 2019 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
Type "show copying" and "show warranty" for details.
This GDB was configured as "x86_64-apple-darwin18.5.0".
Type "show configuration" for configuration details.
@IanButterworth
IanButterworth / revise_test_error.txt
Created August 30, 2019 20:29
Revise v2.1.8 error on 1.4.0-DEV.68 (2019-08-28) Ubuntu 64bit
_ _ _(_)_ | Documentation: https://docs.julialang.org
(_) | (_) (_) |
_ _ _| |_ __ _ | Type "?" for help, "]?" for Pkg help.
| | | | | | |/ _` | |
| | |_| | | | (_| | | Version 1.4.0-DEV.68 (2019-08-28)
_/ |\__'_|_|_|\__'_| | Commit 0e009745a3 (2 days old master)
|__/ |
(v1.4) pkg> st Revise
Status `~/.julia/environments/v1.4/Project.toml`
@IanButterworth
IanButterworth / revise_test_error2.txt
Created August 30, 2019 20:36
Revise v2.1.8 error on 1.4.0-DEV.77 (2019-08-30) Ubuntu 64bit
Starting Julia...
_
_ _ _(_)_ | Documentation: https://docs.julialang.org
(_) | (_) (_) |
_ _ _| |_ __ _ | Type "?" for help, "]?" for Pkg help.
| | | | | | |/ _` | |
| | |_| | | | (_| | | Version 1.4.0-DEV.77 (2019-08-30)
_/ |\__'_|_|_|\__'_| | Commit 2021d039df (0 days old master)
|__/ |
@IanButterworth
IanButterworth / revise_test_error3.txt
Created August 30, 2019 22:34
Revise v2.1.9 error on 1.4.0-DEV.77 (2019-08-30) Ubuntu 64bit
Starting Julia...
_
_ _ _(_)_ | Documentation: https://docs.julialang.org
(_) | (_) (_) |
_ _ _| |_ __ _ | Type "?" for help, "]?" for Pkg help.
| | | | | | |/ _` | |
| | |_| | | | (_| | | Version 1.4.0-DEV.77 (2019-08-30)
_/ |\__'_|_|_|\__'_| | Commit 2021d039df (0 days old master)
|__/ |
@IanButterworth
IanButterworth / pc_bisector.jl
Last active February 20, 2020 00:15
PackageCompiler.jl precompile statement failure bisector
using PackageCompiler, Random
function kfoldperm(N,k)
n,r = divrem(N,k)
b = collect(1:n:N+1)
for i in 1:length(b)
b[i] += i > r ? r : i-1
end
p = randperm(N)
return [p[r] for r in [b[i]:b[i+1]-1 for i=1:k]]
## On julia master, aarch64
## Caused by
## Base.precompile(Tuple{typeof(Base.copyto!), Array{UInt8, 2}, Base.IteratorsMD.CartesianIndices{2, Tuple{Base.UnitRange{Int64}, Base.UnitRange{Int64}}}, Array{UInt8, 2}, Base.IteratorsMD.CartesianIndices{2, Tuple{Base.UnitRange{Int64}, Base.UnitRange{Int64}}}})
## Errors
## ptrtoint not supported for non-integral pointers
## inttoptr not supported for non-integral pointers
## ptrtoint not supported for non-integral pointers
## inttoptr not supported for non-integral pointers
## On julia master, aarch64
## Caused by
Base.precompile(Tuple{typeof(Base.circshift!), Array{UInt8, 2}, Array{UInt8, 2}, Tuple{Int64, Int64}})
## Errors
ptrtoint not supported for non-integral pointers
inttoptr not supported for non-integral pointers
ptrtoint not supported for non-integral pointers
inttoptr not supported for non-integral pointers
(Tuple{Zygote.var"##s3298#1892",Any,Any,Any,Any}, 13063)
(Tuple{Zygote.var"##s3298#1893",Any,Any,Any}, 12758)
(Tuple{typeof(Zygote._lookup_grad),Type{T} where T}, 11014)
(Tuple{typeof(Zygote._lookup_grad),Any}, 10958)
(Tuple{Core.var"#Type##kw",NamedTuple{(:varargs, :normalise),_A} where _A<:Tuple,Type{Zygote.Adjoint},IRTools.Inner.IR}, 8486)
(Tuple{Zygote.var"##Adjoint#30",Any,Any,Type{Zygote.Adjoint},IRTools.Inner.IR}, 8472)
(Tuple{Core.var"#Type##kw",NamedTuple{(:varargs,),Tuple{Nothing}},Type{Zygote.Adjoint},IRTools.Inner.IR}, 8461)
(Tuple{Core.var"#Type##kw",NamedTuple{(:varargs, :normalise),Tuple{Nothing,Bool}},Type{Zygote.Adjoint},IRTools.Inner.IR}, 8461)
(Tuple{Core.var"#Type##kw",NamedTuple{(:varargs, :normalise),Tuple{Int64,Bool}},Type{Zygote.Adjoint},IRTools.Inner.IR}, 8461)
(Tuple{Zygote.var"##Adjoint#30",Nothing,Bool,Type{Zygote.Adjoint},IRTools.Inner.IR}, 8454)