repo_full_name stringlengths 6 93 | repo_url stringlengths 25 112 | repo_api_url stringclasses 28
values | owner stringclasses 28
values | repo_name stringclasses 28
values | description stringclasses 28
values | stars int64 617 98.8k | forks int64 31 355 ⌀ | watchers int64 990 999 ⌀ | license stringclasses 2
values | default_branch stringclasses 2
values | repo_created_at timestamp[s]date 2012-07-24 23:12:50 2025-06-16 08:07:28 ⌀ | repo_updated_at timestamp[s]date 2026-02-23 15:23:15 2026-05-03 18:52:12 ⌀ | repo_topics listlengths 0 13 ⌀ | repo_languages unknown | is_fork bool 1
class | open_issues int64 3 104 ⌀ | file_path stringlengths 3 208 | file_name stringclasses 509
values | file_extension stringclasses 1
value | file_size_bytes int64 101 84k ⌀ | file_url stringclasses 627
values | file_raw_url stringclasses 627
values | file_sha stringclasses 624
values | language stringclasses 8
values | parsed_at stringdate 2026-05-04 01:12:36 2026-05-04 19:41:55 | text stringlengths 100 102k |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
learnsyslab/gym-pybullet-drones | https://github.com/learnsyslab/gym-pybullet-drones | null | null | null | null | 1,995 | null | null | mit | null | null | null | null | null | null | null | gym_pybullet_drones/__init__.py | null | null | null | null | null | null | Python | 2026-05-04T01:40:20.367000 | from gymnasium.envs.registration import register
register(
id='ctrl-aviary-v0',
entry_point='gym_pybullet_drones.envs:CtrlAviary',
)
register(
id='velocity-aviary-v0',
entry_point='gym_pybullet_drones.envs:VelocityAviary',
)
register(
id='hover-aviary-v0',
entry_point='gym_pybullet_drones.env... |
learnsyslab/gym-pybullet-drones | https://github.com/learnsyslab/gym-pybullet-drones | null | null | null | null | 1,995 | null | null | mit | null | null | null | null | null | null | null | gym_pybullet_drones/envs/BetaAviary.py | null | null | null | null | null | null | Python | 2026-05-04T01:40:20.381118 | import numpy as np
from gymnasium import spaces
import socket
import struct
import os
import subprocess
import time
from transforms3d.quaternions import rotate_vector, qconjugate
from gym_pybullet_drones.envs.BaseAviary import BaseAviary
from gym_pybullet_drones.utils.enums import DroneModel, Physics
BASE_PORT_PWM=... |
learnsyslab/gym-pybullet-drones | https://github.com/learnsyslab/gym-pybullet-drones | null | null | null | null | 1,995 | null | null | mit | null | null | null | null | null | null | null | gym_pybullet_drones/control/BaseControl.py | null | null | null | null | null | null | Python | 2026-05-04T01:40:20.401692 | import os
import numpy as np
import xml.etree.ElementTree as etxml
import pkg_resources
from gym_pybullet_drones.utils.enums import DroneModel
class BaseControl(object):
"""Base class for control.
Implements `__init__()`, `reset(), and interface `computeControlFromState()`,
the main method `computeContro... |
learnsyslab/gym-pybullet-drones | https://github.com/learnsyslab/gym-pybullet-drones | null | null | null | null | 1,995 | null | null | mit | null | null | null | null | null | null | null | gym_pybullet_drones/envs/BaseRLAviary.py | null | null | null | null | null | null | Python | 2026-05-04T01:40:20.402962 | import os
import numpy as np
import pybullet as p
from gymnasium import spaces
from collections import deque
from gym_pybullet_drones.envs.BaseAviary import BaseAviary
from gym_pybullet_drones.utils.enums import DroneModel, Physics, ActionType, ObservationType, ImageType
from gym_pybullet_drones.control.DSLPIDControl ... |
learnsyslab/gym-pybullet-drones | https://github.com/learnsyslab/gym-pybullet-drones | null | null | null | null | 1,995 | null | null | mit | null | null | null | null | null | null | null | gym_pybullet_drones/control/CTBRControl.py | null | null | null | null | null | null | Python | 2026-05-04T01:40:20.404971 | import os
import numpy as np
import xml.etree.ElementTree as etxml
import pkg_resources
import socket
import struct
from transforms3d.quaternions import rotate_vector, qconjugate, mat2quat, qmult
from transforms3d.utils import normalized_vector
from gym_pybullet_drones.utils.enums import DroneModel
class CTBRContro... |
learnsyslab/gym-pybullet-drones | https://github.com/learnsyslab/gym-pybullet-drones | null | null | null | null | 1,995 | null | null | mit | null | null | null | null | null | null | null | gym_pybullet_drones/control/DSLPIDControl.py | null | null | null | null | null | null | Python | 2026-05-04T01:40:20.411410 | import math
import numpy as np
import pybullet as p
from scipy.spatial.transform import Rotation
from gym_pybullet_drones.control.BaseControl import BaseControl
from gym_pybullet_drones.utils.enums import DroneModel
class DSLPIDControl(BaseControl):
"""PID control class for Crazyflies.
Based on work conducte... |
learnsyslab/gym-pybullet-drones | https://github.com/learnsyslab/gym-pybullet-drones | null | null | null | null | 1,995 | null | null | mit | null | null | null | null | null | null | null | gym_pybullet_drones/control/MRAC.py | null | null | null | null | null | null | Python | 2026-05-04T01:40:20.422876 | import math
import numpy as np
import pybullet as p
import control as ct
from scipy.spatial.transform import Rotation
from scipy.linalg import solve_lyapunov
from gym_pybullet_drones.control.BaseControl import BaseControl
from gym_pybullet_drones.utils.enums import DroneModel
class MRAC(BaseControl):
"""Model Re... |
learnsyslab/gym-pybullet-drones | https://github.com/learnsyslab/gym-pybullet-drones | null | null | null | null | 1,995 | null | null | mit | null | null | null | null | null | null | null | gym_pybullet_drones/envs/BaseAviary.py | null | null | null | null | null | null | Python | 2026-05-04T01:40:20.429948 | import os
from sys import platform
import time
import collections
from datetime import datetime
import xml.etree.ElementTree as etxml
import pkg_resources
from PIL import Image
# import pkgutil
# egl = pkgutil.get_loader('eglRenderer')
import numpy as np
import pybullet as p
import pybullet_data
import gymnasium as gym... |
learnsyslab/gym-pybullet-drones | https://github.com/learnsyslab/gym-pybullet-drones | null | null | null | null | 1,995 | null | null | mit | null | null | null | null | null | null | null | gym_pybullet_drones/envs/CFAviary.py | null | null | null | null | null | null | Python | 2026-05-04T01:40:20.511193 | import numpy as np
from gymnasium import spaces
import socket
import math
from scipy.spatial.transform import Rotation as R
from gym_pybullet_drones.envs.BaseAviary import BaseAviary
from gym_pybullet_drones.utils.enums import DroneModel, Physics
try:
import pycffirmware as firm
except ImportError as e:
rai... |
learnsyslab/gym-pybullet-drones | https://github.com/learnsyslab/gym-pybullet-drones | null | null | null | null | 1,995 | null | null | mit | null | null | null | null | null | null | null | gym_pybullet_drones/envs/HoverAviary.py | null | null | null | null | null | null | Python | 2026-05-04T01:40:21.553158 | import numpy as np
from gym_pybullet_drones.envs.BaseRLAviary import BaseRLAviary
from gym_pybullet_drones.utils.enums import DroneModel, Physics, ActionType, ObservationType
class HoverAviary(BaseRLAviary):
"""Single agent RL problem: hover at position."""
###################################################... |
learnsyslab/gym-pybullet-drones | https://github.com/learnsyslab/gym-pybullet-drones | null | null | null | null | 1,995 | null | null | mit | null | null | null | null | null | null | null | gym_pybullet_drones/envs/CtrlAviary.py | null | null | null | null | null | null | Python | 2026-05-04T01:40:21.554380 | import numpy as np
from gymnasium import spaces
from gym_pybullet_drones.envs.BaseAviary import BaseAviary
from gym_pybullet_drones.utils.enums import DroneModel, Physics
class CtrlAviary(BaseAviary):
"""Multi-drone environment class for control applications."""
##############################################... |
learnsyslab/gym-pybullet-drones | https://github.com/learnsyslab/gym-pybullet-drones | null | null | null | null | 1,995 | null | null | mit | null | null | null | null | null | null | null | gym_pybullet_drones/envs/MultiHoverAviary.py | null | null | null | null | null | null | Python | 2026-05-04T01:40:21.554930 | import numpy as np
from gym_pybullet_drones.envs.BaseRLAviary import BaseRLAviary
from gym_pybullet_drones.utils.enums import DroneModel, Physics, ActionType, ObservationType
class MultiHoverAviary(BaseRLAviary):
"""Multi-agent RL problem: leader-follower."""
#################################################... |
learnsyslab/gym-pybullet-drones | https://github.com/learnsyslab/gym-pybullet-drones | null | null | null | null | 1,995 | null | null | mit | null | null | null | null | null | null | null | gym_pybullet_drones/examples/cf.py | null | null | null | null | null | null | Python | 2026-05-04T01:40:21.556758 | """CrazyFlie software-in-the-loop control example.
Setup
-----
Step 1: Clone pycffirmware from https://github.com/learnsyslab/pycffirmware
Step 2: Follow the install instructions for pycffirmware in its README
Example
-------
In terminal, run:
python gym_pybullet_drones/examples/cf.py
"""
import time
import argpa... |
learnsyslab/gym-pybullet-drones | https://github.com/learnsyslab/gym-pybullet-drones | null | null | null | null | 1,995 | null | null | mit | null | null | null | null | null | null | null | gym_pybullet_drones/envs/__init__.py | null | null | null | null | null | null | Python | 2026-05-04T01:40:22.161542 | from gym_pybullet_drones.envs.BetaAviary import BetaAviary
from gym_pybullet_drones.envs.CtrlAviary import CtrlAviary
from gym_pybullet_drones.envs.HoverAviary import HoverAviary
from gym_pybullet_drones.envs.MultiHoverAviary import MultiHoverAviary
from gym_pybullet_drones.envs.VelocityAviary import VelocityAviary
|
learnsyslab/gym-pybullet-drones | https://github.com/learnsyslab/gym-pybullet-drones | null | null | null | null | 1,995 | null | null | mit | null | null | null | null | null | null | null | gym_pybullet_drones/examples/beta.py | null | null | null | null | null | null | Python | 2026-05-04T01:40:22.162065 | """Control + Betaflight.
Setup
-----
Use script `gym_pybullet_drones/assets/clone_bfs.sh` to create
executables for as many drones as needed (e.g. 2):
$ ./gym_pybullet_drones/assets/clone_bfs.sh 2
Note
-------
This example will automatically start as many SITL Betaflight as drones
in the simulation in separate t... |
learnsyslab/gym-pybullet-drones | https://github.com/learnsyslab/gym-pybullet-drones | null | null | null | null | 1,995 | null | null | mit | null | null | null | null | null | null | null | gym_pybullet_drones/examples/downwash.py | null | null | null | null | null | null | Python | 2026-05-04T01:40:22.163988 | """Script demonstrating the implementation of the downwash effect model.
Example
-------
In a terminal, run as:
$ python downwash.py
Notes
-----
The drones move along 2D trajectories in the X-Z plane, between x == +.5 and -.5.
"""
import time
import argparse
import numpy as np
from gym_pybullet_drones.utils.ut... |
learnsyslab/gym-pybullet-drones | https://github.com/learnsyslab/gym-pybullet-drones | null | null | null | null | 1,995 | null | null | mit | null | null | null | null | null | null | null | gym_pybullet_drones/envs/VelocityAviary.py | null | null | null | null | null | null | Python | 2026-05-04T01:40:22.596747 | import os
import numpy as np
from gymnasium import spaces
from gym_pybullet_drones.envs.BaseAviary import BaseAviary
from gym_pybullet_drones.utils.enums import DroneModel, Physics
from gym_pybullet_drones.control.DSLPIDControl import DSLPIDControl
class VelocityAviary(BaseAviary):
"""Multi-drone environment clas... |
learnsyslab/gym-pybullet-drones | https://github.com/learnsyslab/gym-pybullet-drones | null | null | null | null | 1,995 | null | null | mit | null | null | null | null | null | null | null | gym_pybullet_drones/examples/debug.py | null | null | null | null | null | null | Python | 2026-05-04T01:40:22.627002 | import time
import numpy as np
import pybullet as p
import pybullet_data
DURATION_SEC = 5
X_AX_1 = -1; Y_AX_1 = -1; Z_AX_1 = -1;
X_AX_2 = -1; Y_AX_2 = -1; Z_AX_2 = -1;
TEXT = -1
if __name__ == "__main__":
PYB_CLIENT = p.connect(p.GUI, key=0); p.setRealTimeSimulation(0, physicsClientId=PYB_CLIENT); p.setTimeSt... |
learnsyslab/gym-pybullet-drones | https://github.com/learnsyslab/gym-pybullet-drones | null | null | null | null | 1,995 | null | null | mit | null | null | null | null | null | null | null | gym_pybullet_drones/examples/play.py | null | null | null | null | null | null | Python | 2026-05-04T01:40:22.630560 | import os
import time
import argparse
import numpy as np
import gymnasium as gym
from stable_baselines3 import PPO
from gym_pybullet_drones.envs.HoverAviary import HoverAviary
from gym_pybullet_drones.envs.MultiHoverAviary import MultiHoverAviary
from gym_pybullet_drones.utils.enums import ObservationType, ActionType
f... |
learnsyslab/gym-pybullet-drones | https://github.com/learnsyslab/gym-pybullet-drones | null | null | null | null | 1,995 | null | null | mit | null | null | null | null | null | null | null | gym_pybullet_drones/examples/pid.py | null | null | null | null | null | null | Python | 2026-05-04T01:40:22.641049 | """Script demonstrating the joint use of simulation and control.
The simulation is run by a `CtrlAviary` environment.
The control is given by the PID implementation in `DSLPIDControl`.
Example
-------
In a terminal, run as:
$ python pid.py
Notes
-----
The drones move, at different altitudes, along cicular traje... |
learnsyslab/gym-pybullet-drones | https://github.com/learnsyslab/gym-pybullet-drones | null | null | null | null | 1,995 | null | null | mit | null | null | null | null | null | null | null | gym_pybullet_drones/examples/learn.py | null | null | null | null | null | null | Python | 2026-05-04T01:40:22.644077 | """Script demonstrating the use of `gym_pybullet_drones`'s Gymnasium interface.
Classes HoverAviary and MultiHoverAviary are used as learning envs for the PPO algorithm.
Example
-------
In a terminal, run as:
$ python learn.py --multiagent false
$ python learn.py --multiagent true
Notes
-----
This is a mini... |
learnsyslab/gym-pybullet-drones | https://github.com/learnsyslab/gym-pybullet-drones | null | null | null | null | 1,995 | null | null | mit | null | null | null | null | null | null | null | gym_pybullet_drones/examples/mrac.py | null | null | null | null | null | null | Python | 2026-05-04T01:40:22.663013 | import time
import numpy as np
import pybullet as p
import matplotlib.pyplot as plt
import pybullet_data
from gym_pybullet_drones.utils.enums import DroneModel, Physics
from gym_pybullet_drones.envs.CtrlAviary import CtrlAviary
from gym_pybullet_drones.control.MRAC import MRAC
from gym_pybullet_drones.utils.Logger im... |
learnsyslab/gym-pybullet-drones | https://github.com/learnsyslab/gym-pybullet-drones | null | null | null | null | 1,995 | null | null | mit | null | null | null | null | null | null | null | gym_pybullet_drones/examples/pid_velocity.py | null | null | null | null | null | null | Python | 2026-05-04T01:40:22.727671 | """Script demonstrating the joint use of velocity input.
The simulation is run by a `VelocityAviary` environment.
Example
-------
In a terminal, run as:
$ python pid_velocity.py
Notes
-----
The drones use interal PID control to track a target velocity.
"""
import os
import time
import argparse
from datetime im... |
learnsyslab/gym-pybullet-drones | https://github.com/learnsyslab/gym-pybullet-drones | null | null | null | null | 1,995 | null | null | mit | null | null | null | null | null | null | null | gym_pybullet_drones/utils/enums.py | null | null | null | null | null | null | Python | 2026-05-04T01:40:22.735347 | from enum import Enum
class DroneModel(Enum):
"""Drone models enumeration class."""
CF2X = "cf2x" # Bitcraze Craziflie 2.0 in the X configuration
CF2P = "cf2p" # Bitcraze Craziflie 2.0 in the + configuration
RACE = "racer" # Racer drone in the X configuration
###################################... |
learnsyslab/gym-pybullet-drones | https://github.com/learnsyslab/gym-pybullet-drones | null | null | null | null | 1,995 | null | null | mit | null | null | null | null | null | null | null | gym_pybullet_drones/utils/Logger.py | null | null | null | null | null | null | Python | 2026-05-04T01:40:22.739996 | import os
from datetime import datetime
from cycler import cycler
import numpy as np
import matplotlib.pyplot as plt
os.environ['KMP_DUPLICATE_LIB_OK']='True'
class Logger(object):
"""A class for logging and visualization.
Stores, saves to file, and plots the kinematic information and RPMs
of a simulatio... |
learnsyslab/gym-pybullet-drones | https://github.com/learnsyslab/gym-pybullet-drones | null | null | null | null | 1,995 | null | null | mit | null | null | null | null | null | null | null | gym_pybullet_drones/utils/utils.py | null | null | null | null | null | null | Python | 2026-05-04T01:40:23.174422 | """General use functions.
"""
import time
import argparse
import numpy as np
from scipy.optimize import nnls
################################################################################
def sync(i, start_time, timestep):
"""Syncs the stepped simulation with the wall-clock.
Function `sync` calls time.slee... |
learnsyslab/gym-pybullet-drones | https://github.com/learnsyslab/gym-pybullet-drones | null | null | null | null | 1,995 | null | null | mit | null | null | null | null | null | null | null | tests/test_build.py | null | null | null | null | null | null | Python | 2026-05-04T01:40:23.226470 | def test_imports():
import gym_pybullet_drones
import gym_pybullet_drones.control
import gym_pybullet_drones.envs
import gym_pybullet_drones.examples
import gym_pybullet_drones.utils
|
learnsyslab/gym-pybullet-drones | https://github.com/learnsyslab/gym-pybullet-drones | null | null | null | null | 1,995 | null | null | mit | null | null | null | null | null | null | null | tests/test_examples.py | null | null | null | null | null | null | Python | 2026-05-04T01:40:23.255993 | def test_pid():
from gym_pybullet_drones.examples.pid import run
run(gui=False, plot=False, output_folder='tmp')
def test_pid_velocity():
from gym_pybullet_drones.examples.pid_velocity import run
run(gui=False, plot=False, output_folder='tmp')
def test_downwash():
from gym_pybullet_drones.examples... |
PacktPublishing/Advanced-Deep-Learning-with-Keras | https://github.com/PacktPublishing/Advanced-Deep-Learning-with-Keras | null | null | null | null | 1,993 | null | null | mit | null | null | null | null | null | null | null | chapter1-keras-quick-tour/sgd-2-min-1.5.4.py | null | null | null | null | null | null | Python | 2026-05-04T01:40:25.400510 | '''Utility for plotting a polynomial with 2 minima
and its derivative
'''
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import numpy as np
import matplotlib.pyplot as plt
plt.style.use('grayscale')
x = np.arange(-2.5, 2.5, 0.1)
c = [1, -0.2, -5, 0, 4]
d... |
PacktPublishing/Advanced-Deep-Learning-with-Keras | https://github.com/PacktPublishing/Advanced-Deep-Learning-with-Keras | null | null | null | null | 1,993 | null | null | mit | null | null | null | null | null | null | null | chapter1-keras-quick-tour/mnist-sampler-1.3.1.py | null | null | null | null | null | null | Python | 2026-05-04T01:40:25.402629 | '''
Demonstrates how to sample and plot MNIST digits
using Keras API
https://github.com/PacktPublishing/Advanced-Deep-Learning-with-Keras
'''
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import numpy as np
from tensorflow.keras.datasets import mnist
impo... |
PacktPublishing/Advanced-Deep-Learning-with-Keras | https://github.com/PacktPublishing/Advanced-Deep-Learning-with-Keras | null | null | null | null | 1,993 | null | null | mit | null | null | null | null | null | null | null | chapter1-keras-quick-tour/linear-model-1.2.1.py | null | null | null | null | null | null | Python | 2026-05-04T01:40:25.408107 | '''A simple MLP in Keras implementing linear regression.
'''
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
# numpy package
import numpy as np
# keras modules
from tensorflow.keras.models import Sequential
from tensorflow.keras.layers import Dense
from t... |
PacktPublishing/Advanced-Deep-Learning-with-Keras | https://github.com/PacktPublishing/Advanced-Deep-Learning-with-Keras | null | null | null | null | 1,993 | null | null | mit | null | null | null | null | null | null | null | chapter1-keras-quick-tour/rnn-model-1.3.1.py | null | null | null | null | null | null | Python | 2026-05-04T01:40:25.409101 | '''
A Simple RNN model with 30 x 12 input and 5-dim one-hot vector
'''
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
# keras modules
from tensorflow.keras.models import Sequential
from tensorflow.keras.layers import Dense, SimpleRNN
from tensorflow.keras.... |
PacktPublishing/Advanced-Deep-Learning-with-Keras | https://github.com/PacktPublishing/Advanced-Deep-Learning-with-Keras | null | null | null | null | 1,993 | null | null | mit | null | null | null | null | null | null | null | chapter1-keras-quick-tour/cnn-mnist-1.4.1.py | null | null | null | null | null | null | Python | 2026-05-04T01:40:25.417431 | ''' CNN MNIST digits classification
3-layer CNN for MNIST digits classification
First 2 layers - Conv2D-ReLU-MaxPool
3rd layer - Conv2D-ReLU-Dropout
4th layer - Dense(10)
Output Activation - softmax
Optimizer - Adam
99.4% test accuracy in 10epochs
https://github.com/PacktPublishing/Advanced-Deep-Learning-with-Keras... |
PacktPublishing/Advanced-Deep-Learning-with-Keras | https://github.com/PacktPublishing/Advanced-Deep-Learning-with-Keras | null | null | null | null | 1,993 | null | null | mit | null | null | null | null | null | null | null | chapter1-keras-quick-tour/rnn-mnist-1.5.1.py | null | null | null | null | null | null | Python | 2026-05-04T01:40:25.418491 | '''
RNN for MNIST digits classification
98.3% test accuracy in 20epochs
https://github.com/PacktPublishing/Advanced-Deep-Learning-with-Keras
'''
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import numpy as np
from tensorflow.keras.models import Sequentia... |
PacktPublishing/Advanced-Deep-Learning-with-Keras | https://github.com/PacktPublishing/Advanced-Deep-Learning-with-Keras | null | null | null | null | 1,993 | null | null | mit | null | null | null | null | null | null | null | chapter1-keras-quick-tour/mlp-mnist-1.3.2.py | null | null | null | null | null | null | Python | 2026-05-04T01:40:25.420073 | '''
A MLP network for MNIST digits classification
98.3% test accuracy in 20epochs
https://github.com/PacktPublishing/Advanced-Deep-Learning-with-Keras
'''
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import numpy as np
from tensorflow.keras.models impo... |
PacktPublishing/Advanced-Deep-Learning-with-Keras | https://github.com/PacktPublishing/Advanced-Deep-Learning-with-Keras | null | null | null | null | 1,993 | null | null | mit | null | null | null | null | null | null | null | chapter1-keras-quick-tour/sgd-1.5.3.py | null | null | null | null | null | null | Python | 2026-05-04T01:40:25.422441 | '''Utility for plotting a 2nd deg polynomial and
its derivative
'''
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import numpy as np
import matplotlib.pyplot as plt
plt.style.use('grayscale')
x = np.arange(-1, 2, 0.1)
c = [1, -1, -1]
d = [2, -1]
y = np.p... |
PacktPublishing/Advanced-Deep-Learning-with-Keras | https://github.com/PacktPublishing/Advanced-Deep-Learning-with-Keras | null | null | null | null | 1,993 | null | null | mit | null | null | null | null | null | null | null | chapter1-keras-quick-tour/plot-linear-1.1.1.py | null | null | null | null | null | null | Python | 2026-05-04T01:40:25.514303 | '''Utility for plotting a linear function
with and without noise
'''
import numpy as np
import matplotlib.pyplot as plt
want_noise = True
# grayscale plot, comment if color is wanted
plt.style.use('grayscale')
# generate data bet -1,1 interval of 0.2
x = np.arange(-1,1,0.2)
y = 2*x + 3
plt.xlabel('x')
plt.ylabel('y=... |
PacktPublishing/Advanced-Deep-Learning-with-Keras | https://github.com/PacktPublishing/Advanced-Deep-Learning-with-Keras | null | null | null | null | 1,993 | null | null | mit | null | null | null | null | null | null | null | chapter1-keras-quick-tour/cnn-model-1.3.2.py | null | null | null | null | null | null | Python | 2026-05-04T01:40:25.517121 | '''A sample CNN network for classification
'''
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
# keras modules
from tensorflow.keras.models import Sequential
from tensorflow.keras.layers import Dense, Conv2D, Flatten
from tensorflow.keras.optimizers import ... |
PacktPublishing/Advanced-Deep-Learning-with-Keras | https://github.com/PacktPublishing/Advanced-Deep-Learning-with-Keras | null | null | null | null | 1,993 | null | null | mit | null | null | null | null | null | null | null | chapter10-policy/policygradient-car-10.1.1.py | null | null | null | null | null | null | Python | 2026-05-04T01:40:26.073423 | """Code implementation of Policy Gradient Methods as solution
to MountainCarCountinuous-v0 problem
Methods implemented:
1) REINFORCE
2) REINFORCE with Baseline
3) Actor-Critic
4) A2C
References:
1) Sutton and Barto, Reinforcement Learning: An Introduction
(2017)
2) Mnih, et al. Asynchrono... |
PacktPublishing/Advanced-Deep-Learning-with-Keras | https://github.com/PacktPublishing/Advanced-Deep-Learning-with-Keras | null | null | null | null | 1,993 | null | null | mit | null | null | null | null | null | null | null | chapter11-detection/data_generator.py | null | null | null | null | null | null | Python | 2026-05-04T01:40:26.103821 | """Data generator
This is a multi-threaded, scalable, and efficient way of reading huge images
from a filesystem as dataset
"""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
from tensorflow.python.keras.utils.data_... |
PacktPublishing/Advanced-Deep-Learning-with-Keras | https://github.com/PacktPublishing/Advanced-Deep-Learning-with-Keras | null | null | null | null | 1,993 | null | null | mit | null | null | null | null | null | null | null | chapter11-detection/common_utils.py | null | null | null | null | null | null | Python | 2026-05-04T01:40:26.104376 | """Utility functions
"""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
def print_log(param, verbose=0):
if verbose > 0:
print(param)
|
PacktPublishing/Advanced-Deep-Learning-with-Keras | https://github.com/PacktPublishing/Advanced-Deep-Learning-with-Keras | null | null | null | null | 1,993 | null | null | mit | null | null | null | null | null | null | null | chapter11-detection/loss.py | null | null | null | null | null | null | Python | 2026-05-04T01:40:26.140464 | """Loss functions for object detection
"""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
import tensorflow as tf
from tensorflow.keras import backend as K
from tensorflow.keras.losses import Huber
import numpy as ... |
PacktPublishing/Advanced-Deep-Learning-with-Keras | https://github.com/PacktPublishing/Advanced-Deep-Learning-with-Keras | null | null | null | null | 1,993 | null | null | mit | null | null | null | null | null | null | null | chapter11-detection/config.py | null | null | null | null | null | null | Python | 2026-05-04T01:40:26.145304 | """Project config
"""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
params = {
'epoch_offset': 0,
'classes' : ["background", "Water", "Soda", "Juice"],
'prices' : [0.0, 10.0, 40.0, 35.0]
}
# aspect ratios
def anchor_aspec... |
PacktPublishing/Advanced-Deep-Learning-with-Keras | https://github.com/PacktPublishing/Advanced-Deep-Learning-with-Keras | null | null | null | null | 1,993 | null | null | mit | null | null | null | null | null | null | null | chapter11-detection/layer_utils.py | null | null | null | null | null | null | Python | 2026-05-04T01:40:26.153802 | """Layer utils
Utility functions for computing IOU, anchor boxes, masks,
and bounding box offsets
"""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
import numpy as np
import config
import math
from tensorflow.kera... |
PacktPublishing/Advanced-Deep-Learning-with-Keras | https://github.com/PacktPublishing/Advanced-Deep-Learning-with-Keras | null | null | null | null | 1,993 | null | null | mit | null | null | null | null | null | null | null | chapter11-detection/boxes.py | null | null | null | null | null | null | Python | 2026-05-04T01:40:26.275906 | """Visualize bounding boxes
"""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
import numpy as np
import skimage
import matplotlib.pyplot as plt
import os
import layer_utils
import label_utils
import math
from skim... |
PacktPublishing/Advanced-Deep-Learning-with-Keras | https://github.com/PacktPublishing/Advanced-Deep-Learning-with-Keras | null | null | null | null | 1,993 | null | null | mit | null | null | null | null | null | null | null | chapter11-detection/model.py | null | null | null | null | null | null | Python | 2026-05-04T01:40:26.282497 | """SSD model builder
Utilities for building network layers are also provided
"""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
from tensorflow.keras.layers import Activation, Dense, Input
from tensorflow.keras.layer... |
PacktPublishing/Advanced-Deep-Learning-with-Keras | https://github.com/PacktPublishing/Advanced-Deep-Learning-with-Keras | null | null | null | null | 1,993 | null | null | mit | null | null | null | null | null | null | null | chapter11-detection/model_utils.py | null | null | null | null | null | null | Python | 2026-05-04T01:40:26.357544 | """Utility functionns for model building, training and evaluation
"""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
import config
import argparse
from resnet import build_resnet
def lr_scheduler(epoch):
"""Lea... |
PacktPublishing/Advanced-Deep-Learning-with-Keras | https://github.com/PacktPublishing/Advanced-Deep-Learning-with-Keras | null | null | null | null | 1,993 | null | null | mit | null | null | null | null | null | null | null | chapter11-detection/label_utils.py | null | null | null | null | null | null | Python | 2026-05-04T01:40:26.389728 | """Label utility functions
Main use: labeling, dictionary of colors,
label retrieval, loading label csv file,
drawing label on an image
"""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
import numpy as np
import c... |
PacktPublishing/Advanced-Deep-Learning-with-Keras | https://github.com/PacktPublishing/Advanced-Deep-Learning-with-Keras | null | null | null | null | 1,993 | null | null | mit | null | null | null | null | null | null | null | chapter11-detection/resnet.py | null | null | null | null | null | null | Python | 2026-05-04T01:40:26.839333 | """ResNet model builder as SSD backbone
Adopted fr Chapter 2 of ADL - Deep Networks
ResNet v1
[a] Deep Residual Learning for Image Recognition
https://arxiv.org/pdf/1512.03385.pdf
ResNet v2
[b] Identity Mappings in Deep Residual Networks
https://arxiv.org/pdf/1603.05027.pdf
"""
from __future__ import absolute_import... |
PacktPublishing/Advanced-Deep-Learning-with-Keras | https://github.com/PacktPublishing/Advanced-Deep-Learning-with-Keras | null | null | null | null | 1,993 | null | null | mit | null | null | null | null | null | null | null | chapter11-detection/ssd-11.6.1.py | null | null | null | null | null | null | Python | 2026-05-04T01:40:26.844223 | """SSD class to build, train, eval an SSD network
1) ResNet50 (v2) backbone.
Train with 6 layers of feature maps.
Pls adjust batch size depending on your GPU memory.
For 1060 with 6GB, -b=1. For V100 with 32GB, -b=4
python3 ssd-11.6.1.py -t -b=4
2) ResNet50 (v2) backbone.
Train from a previously sa... |
PacktPublishing/Advanced-Deep-Learning-with-Keras | https://github.com/PacktPublishing/Advanced-Deep-Learning-with-Keras | null | null | null | null | 1,993 | null | null | mit | null | null | null | null | null | null | null | chapter11-detection/utils/json2csv.py | null | null | null | null | null | null | Python | 2026-05-04T01:40:26.903251 | '''
Pretty print: python3 -m json.tool < some.json
'''
import json
import argparse
import os
def load_json(data_path, jsfile):
with open(os.path.join(data_path, jsfile), 'r') as f:
js = json.load(f)
return js
if __name__ == '__main__':
parser = argparse.ArgumentParser()
parser.add_argum... |
PacktPublishing/Advanced-Deep-Learning-with-Keras | https://github.com/PacktPublishing/Advanced-Deep-Learning-with-Keras | null | null | null | null | 1,993 | null | null | mit | null | null | null | null | null | null | null | chapter11-detection/utils/video_capture.py | null | null | null | null | null | null | Python | 2026-05-04T01:40:26.904611 | """
python3 videocapture.py --camera=1
"""
import numpy as np
import cv2
import argparse
import datetime
import os
import time
from skimage.io import imsave
class VideoCapture():
def __init__(self,
camera=0,
width=640,
height=480,
path="datase... |
PacktPublishing/Advanced-Deep-Learning-with-Keras | https://github.com/PacktPublishing/Advanced-Deep-Learning-with-Keras | null | null | null | null | 1,993 | null | null | mit | null | null | null | null | null | null | null | chapter12-segmentation/data_generator.py | null | null | null | null | null | null | Python | 2026-05-04T01:40:26.922243 | """Data generator
This is a multi-threaded, scalable, and efficient way of reading huge images
from a filesystem as dataset
"""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
from tensorflow.keras.utils import Seque... |
PacktPublishing/Advanced-Deep-Learning-with-Keras | https://github.com/PacktPublishing/Advanced-Deep-Learning-with-Keras | null | null | null | null | 1,993 | null | null | mit | null | null | null | null | null | null | null | chapter11-detection/video.py | null | null | null | null | null | null | Python | 2026-05-04T01:40:26.923526 | """Video demo utils for showing live object detection from a camera
python3 video_demo.py --restore-weights=weights/<weights.h5>
"""
import numpy as np
import cv2
import argparse
import datetime
import skimage
from skimage.io import imread
class VideoDemo():
def __init__(self,
camera=0,
... |
PacktPublishing/Advanced-Deep-Learning-with-Keras | https://github.com/PacktPublishing/Advanced-Deep-Learning-with-Keras | null | null | null | null | 1,993 | null | null | mit | null | null | null | null | null | null | null | chapter11-detection/video_demo.py | null | null | null | null | null | null | Python | 2026-05-04T01:40:26.944256 | """Video demo utils for showing live object detection from a camera
python3 video_demo.py --restore-weights=weights/<weights.h5>
"""
import ssd
import numpy as np
import cv2
import argparse
import datetime
import skimage
import label_utils
import config
from ssd import SSD
from boxes import show_boxes
from skimage.... |
PacktPublishing/Advanced-Deep-Learning-with-Keras | https://github.com/PacktPublishing/Advanced-Deep-Learning-with-Keras | null | null | null | null | 1,993 | null | null | mit | null | null | null | null | null | null | null | chapter11-detection/utils/resize_json.py | null | null | null | null | null | null | Python | 2026-05-04T01:40:26.985885 | """
python3 -m json.tool < via.json > grab.json
"""
import json
import argparse
import os
import copy
def load_json(data_path, jsfile):
with open(os.path.join(data_path, jsfile), 'r') as f:
js = json.load(f)
return js
if __name__ == '__main__':
parser = argparse.ArgumentParser()
parser... |
PacktPublishing/Advanced-Deep-Learning-with-Keras | https://github.com/PacktPublishing/Advanced-Deep-Learning-with-Keras | null | null | null | null | 1,993 | null | null | mit | null | null | null | null | null | null | null | chapter12-segmentation/model.py | null | null | null | null | null | null | Python | 2026-05-04T01:40:27.016230 | """Helper function for building FCN model.
Utilities for building network layers are also provided.
"""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
from tensorflow.keras.layers import Activation, Input
from tensor... |
PacktPublishing/Advanced-Deep-Learning-with-Keras | https://github.com/PacktPublishing/Advanced-Deep-Learning-with-Keras | null | null | null | null | 1,993 | null | null | mit | null | null | null | null | null | null | null | chapter12-segmentation/fcn-12.3.1.py | null | null | null | null | null | null | Python | 2026-05-04T01:40:27.017385 | """FCN class to build, train, eval an FCN model for semantic
segmentation
1) ResNet50 (v2) backbone.
Train with 6 layers of feature maps.
Pls adjust batch size depending on your GPU memory.
For 1060 with 6GB, --batch-size=1. For V100 with 32GB,
--batch-size=4
python3 fcn-12.3.1.py --train --batc... |
PacktPublishing/Advanced-Deep-Learning-with-Keras | https://github.com/PacktPublishing/Advanced-Deep-Learning-with-Keras | null | null | null | null | 1,993 | null | null | mit | null | null | null | null | null | null | null | chapter12-segmentation/model_utils.py | null | null | null | null | null | null | Python | 2026-05-04T01:40:27.421054 | """Utility functionns for model building, training and evaluation
"""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
import argparse
import os
from resnet import build_resnet
def lr_scheduler(epoch):
"""Learnin... |
PacktPublishing/Advanced-Deep-Learning-with-Keras | https://github.com/PacktPublishing/Advanced-Deep-Learning-with-Keras | null | null | null | null | 1,993 | null | null | mit | null | null | null | null | null | null | null | chapter12-segmentation/resnet.py | null | null | null | null | null | null | Python | 2026-05-04T01:40:27.466773 | """ResNet model builder as backbone
Adopted fr Chapter 2 of ADL - Deep Networks
ResNet v1
[a] Deep Residual Learning for Image Recognition
https://arxiv.org/pdf/1512.03385.pdf
ResNet v2
[b] Identity Mappings in Deep Residual Networks
https://arxiv.org/pdf/1603.05027.pdf
TODO: Merge with Object Detection code
"""
fr... |
PacktPublishing/Advanced-Deep-Learning-with-Keras | https://github.com/PacktPublishing/Advanced-Deep-Learning-with-Keras | null | null | null | null | 1,993 | null | null | mit | null | null | null | null | null | null | null | chapter13-mi-unsupervised/data_generator.py | null | null | null | null | null | null | Python | 2026-05-04T01:40:27.490291 | """Data generator for center cropped and transformed MNIST images
"""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from tensorflow.keras.utils import Sequence
from tensorflow.keras.utils import to_categorical
from tensorflow.keras.datasets import mnist
... |
PacktPublishing/Advanced-Deep-Learning-with-Keras | https://github.com/PacktPublishing/Advanced-Deep-Learning-with-Keras | null | null | null | null | 1,993 | null | null | mit | null | null | null | null | null | null | null | chapter12-segmentation/utils/generate_gt_segmentation.py | null | null | null | null | null | null | Python | 2026-05-04T01:40:27.505444 | '''
Pretty print: python3 -m json.tool < some.json
'''
import json
import argparse
import os
import numpy as np
import cv2
import matplotlib.pyplot as plt
def load_json(data_path, jsfile):
with open(os.path.join(data_path, jsfile), 'r') as f:
js = json.load(f)
return js
def generate_dataset(arg... |
PacktPublishing/Advanced-Deep-Learning-with-Keras | https://github.com/PacktPublishing/Advanced-Deep-Learning-with-Keras | null | null | null | null | 1,993 | null | null | mit | null | null | null | null | null | null | null | chapter13-mi-unsupervised/iic-13.5.1.py | null | null | null | null | null | null | Python | 2026-05-04T01:40:27.534526 | """Build, train and evaluate an IIC Model
"""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from tensorflow.keras.layers import Input, Dense, Flatten
from tensorflow.keras.models import Model
from tensorflow.keras.optimizers import Adam
from tensorflow.... |
PacktPublishing/Advanced-Deep-Learning-with-Keras | https://github.com/PacktPublishing/Advanced-Deep-Learning-with-Keras | null | null | null | null | 1,993 | null | null | mit | null | null | null | null | null | null | null | chapter13-mi-unsupervised/mine-13.8.1.py | null | null | null | null | null | null | Python | 2026-05-04T01:40:27.552814 | """Build, train and evaluate a MINE Model
"""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from tensorflow.keras.layers import Input, Dense, Add, Activation, Flatten
from tensorflow.keras.models import Model
from tensorflow.keras.optimizers import Adam... |
PacktPublishing/Advanced-Deep-Learning-with-Keras | https://github.com/PacktPublishing/Advanced-Deep-Learning-with-Keras | null | null | null | null | 1,993 | null | null | mit | null | null | null | null | null | null | null | chapter12-segmentation/utils/plot_history.py | null | null | null | null | null | null | Python | 2026-05-04T01:40:27.598008 | '''
'''
import argparse
import os
import numpy as np
import matplotlib.pyplot as plt
def plot_history(args):
y = np.load(args.history)
print("Max: ", np.amax(y))
x = np.arange(1, 101)
plt.xlabel('epoch')
if "iou" in args.history:
plt.ylabel('mIoU')
plt.title('mIoU on test datas... |
PacktPublishing/Advanced-Deep-Learning-with-Keras | https://github.com/PacktPublishing/Advanced-Deep-Learning-with-Keras | null | null | null | null | 1,993 | null | null | mit | null | null | null | null | null | null | null | chapter13-mi-unsupervised/utils.py | null | null | null | null | null | null | Python | 2026-05-04T01:40:27.647258 | from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import numpy as np
from tensorflow.keras.callbacks import Callback
from scipy.optimize import linear_sum_assignment
def unsupervised_labels(y, yp, n_classes, n_clusters):
"""Linear assignment algorithm
... |
PacktPublishing/Advanced-Deep-Learning-with-Keras | https://github.com/PacktPublishing/Advanced-Deep-Learning-with-Keras | null | null | null | null | 1,993 | null | null | mit | null | null | null | null | null | null | null | chapter2-deep-networks/cnn-functional-2.1.1.py | null | null | null | null | null | null | Python | 2026-05-04T01:40:27.711852 | ''' Using Functional API to build CNN
~99.3% test accuracy
'''
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import numpy as np
from tensorflow.keras.layers import Dense, Dropout, Input
from tensorflow.keras.layers import Conv2D, MaxPooling2D, Flatten
fr... |
PacktPublishing/Advanced-Deep-Learning-with-Keras | https://github.com/PacktPublishing/Advanced-Deep-Learning-with-Keras | null | null | null | null | 1,993 | null | null | mit | null | null | null | null | null | null | null | chapter13-mi-unsupervised/vgg.py | null | null | null | null | null | null | Python | 2026-05-04T01:40:27.729969 | """VGG backbone creator
"""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from tensorflow.keras.layers import Dense, Conv2D
from tensorflow.keras.layers import BatchNormalization, Activation
from tensorflow.keras.layers import MaxPooling2D, Input
from t... |
PacktPublishing/Advanced-Deep-Learning-with-Keras | https://github.com/PacktPublishing/Advanced-Deep-Learning-with-Keras | null | null | null | null | 1,993 | null | null | mit | null | null | null | null | null | null | null | chapter2-deep-networks/densenet-cifar10-2.4.1.py | null | null | null | null | null | null | Python | 2026-05-04T01:40:28.066038 | """Trains a 100-Layer DenseNet on the CIFAR10 dataset.
With data augmentation:
Greater than 93.55% test accuracy in 200 epochs
225sec per epoch on GTX 1080Ti
Densely Connected Convolutional Networks
https://arxiv.org/pdf/1608.06993.pdf
http://openaccess.thecvf.com/content_cvpr_2017/papers/
Huang_Densely_Connected... |
PacktPublishing/Advanced-Deep-Learning-with-Keras | https://github.com/PacktPublishing/Advanced-Deep-Learning-with-Keras | null | null | null | null | 1,993 | null | null | mit | null | null | null | null | null | null | null | chapter2-deep-networks/sampler-cifar10-2.1.0.py | null | null | null | null | null | null | Python | 2026-05-04T01:40:28.092300 | '''Demonstrates how to sample and plot CIFAR10 images
using Keras API
'''
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
# numpy package
import numpy as np
import math
# keras mnist module
from keras.datasets import cifar10
# for plotting
import matplotl... |
PacktPublishing/Advanced-Deep-Learning-with-Keras | https://github.com/PacktPublishing/Advanced-Deep-Learning-with-Keras | null | null | null | null | 1,993 | null | null | mit | null | null | null | null | null | null | null | chapter2-deep-networks/cnn-y-network-2.1.2.py | null | null | null | null | null | null | Python | 2026-05-04T01:40:28.122845 | '''Implements a Y-Network using Functional API
~99.3% test accuracy
'''
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import numpy as np
from tensorflow.keras.layers import Dense, Dropout, Input
from tensorflow.keras.layers import Conv2D, MaxPooling2D
f... |
PacktPublishing/Advanced-Deep-Learning-with-Keras | https://github.com/PacktPublishing/Advanced-Deep-Learning-with-Keras | null | null | null | null | 1,993 | null | null | mit | null | null | null | null | null | null | null | chapter3-autoencoders/autoencoder-mnist-3.2.1.py | null | null | null | null | null | null | Python | 2026-05-04T01:40:28.139699 | '''Example of autoencoder model on MNIST dataset
This autoencoder has modular design. The encoder, decoder and autoencoder
are 3 models that share weights. For example, after training the
autoencoder, the encoder can be used to generate latent vectors
of input data for low-dim visualization like PCA or TSNE.
'''
fro... |
PacktPublishing/Advanced-Deep-Learning-with-Keras | https://github.com/PacktPublishing/Advanced-Deep-Learning-with-Keras | null | null | null | null | 1,993 | null | null | mit | null | null | null | null | null | null | null | chapter3-autoencoders/autoencoder-2dim-mnist-3.2.2.py | null | null | null | null | null | null | Python | 2026-05-04T01:40:28.205723 | '''Example of autoencoder model on MNIST dataset using 2dim latent
The autoencoder forces the encoder to discover 2-dim latent vector
that the decoder can recover the original input. The 2-dim latent
vector is projected on 2D space to analyze the distribution of code
in the latent space. The latent space can be naviga... |
PacktPublishing/Advanced-Deep-Learning-with-Keras | https://github.com/PacktPublishing/Advanced-Deep-Learning-with-Keras | null | null | null | null | 1,993 | null | null | mit | null | null | null | null | null | null | null | chapter2-deep-networks/resnet-cifar10-2.2.1.py | null | null | null | null | null | null | Python | 2026-05-04T01:40:28.252297 | """Trains a ResNet on the CIFAR10 dataset.
ResNet v1
[a] Deep Residual Learning for Image Recognition
https://arxiv.org/pdf/1512.03385.pdf
ResNet v2
[b] Identity Mappings in Deep Residual Networks
https://arxiv.org/pdf/1603.05027.pdf
"""
from __future__ import absolute_import
from __future__ import division
from __f... |
PacktPublishing/Advanced-Deep-Learning-with-Keras | https://github.com/PacktPublishing/Advanced-Deep-Learning-with-Keras | null | null | null | null | 1,993 | null | null | mit | null | null | null | null | null | null | null | chapter3-autoencoders/classifier-autoencoder-mnist-3.3.1.py | null | null | null | null | null | null | Python | 2026-05-04T01:40:28.266424 | ''' Autoencoder with Classifier
'''
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import numpy as np
import keras
from keras.layers import Activation, Dense, Dropout, Input, BatchNormalization
from keras.layers import Conv2D, MaxPooling2D, Flatten
from ker... |
PacktPublishing/Advanced-Deep-Learning-with-Keras | https://github.com/PacktPublishing/Advanced-Deep-Learning-with-Keras | null | null | null | null | 1,993 | null | null | mit | null | null | null | null | null | null | null | chapter3-autoencoders/denoising-autoencoder-mnist-3.3.1.py | null | null | null | null | null | null | Python | 2026-05-04T01:40:28.267766 | '''Trains a denoising autoencoder on MNIST dataset.
Denoising is one of the classic applications of autoencoders.
The denoising process removes unwanted noise that corrupted the
true data.
Noise + Data ---> Denoising Autoencoder ---> Data
Given a training dataset of corrupted data as input and
true data as output, a... |
PacktPublishing/Advanced-Deep-Learning-with-Keras | https://github.com/PacktPublishing/Advanced-Deep-Learning-with-Keras | null | null | null | null | 1,993 | null | null | mit | null | null | null | null | null | null | null | chapter4-gan/cgan-mnist-4.3.1.py | null | null | null | null | null | null | Python | 2026-05-04T01:40:28.490035 | '''Trains CGAN on MNIST using Keras
CGAN is Conditional Generative Adversarial Network.
This version of CGAN is similar to DCGAN. The difference mainly
is that the z-vector of geneerator is conditioned by a one-hot label
to produce specific fake images. The discriminator is trained to
discriminate real from fake image... |
PacktPublishing/Advanced-Deep-Learning-with-Keras | https://github.com/PacktPublishing/Advanced-Deep-Learning-with-Keras | null | null | null | null | 1,993 | null | null | mit | null | null | null | null | null | null | null | chapter3-autoencoders/colorization-autoencoder-cifar10-3.4.1.py | null | null | null | null | null | null | Python | 2026-05-04T01:40:28.501457 | '''Colorization autoencoder
The autoencoder is trained with grayscale images as input
and colored images as output.
Colorization autoencoder can be treated like the opposite
of denoising autoencoder. Instead of removing noise, colorization
adds noise (color) to the grayscale image.
Grayscale Images --> Colorization -... |
UKGovernmentBEIS/inspect_ai | https://github.com/UKGovernmentBEIS/inspect_ai | null | null | null | null | 1,993 | null | null | mit | null | null | null | null | null | null | null | docs/_extensions/meridianlabs-ai/inspect-docs/pre-render.py | null | null | null | null | null | null | Python | 2026-05-04T01:40:31.048569 | """Pre-render script for inspect-docs extension.
Generates:
- _include.yml: derived website metadata and reference sidebar
- reference/refs.json: cross-reference index for API docs
"""
import json
import os
import re
import subprocess
import sys
import time
from pathlib import Path
from typing import Any
import yaml... |
UKGovernmentBEIS/inspect_ai | https://github.com/UKGovernmentBEIS/inspect_ai | null | null | null | null | 1,993 | null | null | mit | null | null | null | null | null | null | null | docs/_extensions/meridianlabs-ai/inspect-docs/filters/reference/filter.py | null | null | null | null | null | null | Python | 2026-05-04T01:40:31.050318 | # pyright: basic
import os
import subprocess
import sys
import warnings
from typing import Any, cast
# Suppress a noisy SyntaxWarning emitted by panflute's own io.py on Python
# 3.12+ (the warning is unrelated to our code -- panflute's docstring uses
# `\*\*kwargs`). The filter catches the warning on first compile of ... |
UKGovernmentBEIS/inspect_ai | https://github.com/UKGovernmentBEIS/inspect_ai | null | null | null | null | 1,993 | null | null | mit | null | null | null | null | null | null | null | docs/_extensions/meridianlabs-ai/inspect-docs/_discover.py | null | null | null | null | null | null | Python | 2026-05-04T01:40:31.053955 | """Shared discovery helpers for inferring project metadata from pyproject.toml.
Imported by both `pre-render.py` (extension root) and
`filters/reference/filter.py` (two levels deeper). Each importer is
responsible for adding the extension root to `sys.path` before importing
this module.
"""
import tomllib
from pathli... |
UKGovernmentBEIS/inspect_ai | https://github.com/UKGovernmentBEIS/inspect_ai | null | null | null | null | 1,993 | null | null | mit | null | null | null | null | null | null | null | docs/_extensions/meridianlabs-ai/inspect-docs/filters/reference/parse.py | null | null | null | null | null | null | Python | 2026-05-04T01:40:31.055956 | # pyright: basic
from dataclasses import dataclass
from itertools import islice
from pathlib import Path
from typing import Any, NamedTuple, cast
from griffe import (
Alias,
AliasResolutionError,
Attribute,
Class,
CyclicAliasError,
Docstring,
DocstringSection,
DocstringSectionExamples,
... |
UKGovernmentBEIS/inspect_ai | https://github.com/UKGovernmentBEIS/inspect_ai | null | null | null | null | 1,993 | null | null | mit | null | null | null | null | null | null | null | docs/evals/sync.py | null | null | null | null | null | null | Python | 2026-05-04T01:40:31.056972 | """Load inspect_evals eval.yaml files into normalized EvalRecord dicts.
Reads `{inspect_evals}/src/inspect_evals/*/eval.yaml` and emits records matching
the design schema consumed by the /docs/evals SPA. Categories come from the
upstream `group` field plus optional additions from `evals_overrides.yml`.
Writes are hand... |
UKGovernmentBEIS/inspect_ai | https://github.com/UKGovernmentBEIS/inspect_ai | null | null | null | null | 1,993 | null | null | mit | null | null | null | null | null | null | null | docs/_extensions/meridianlabs-ai/inspect-docs/filters/reference/commands.py | null | null | null | null | null | null | Python | 2026-05-04T01:40:31.058832 | # pyright: basic
# (C) Datadog, Inc. 2020-present
# All rights reserved
# Licensed under the Apache license (see LICENSE)
# from https://github.com/mkdocs/mkdocs-click/blob/master/mkdocs_click/_docs.py
from __future__ import annotations
import importlib
import inspect
from contextlib import ExitStack, contextmanager
... |
UKGovernmentBEIS/inspect_ai | https://github.com/UKGovernmentBEIS/inspect_ai | null | null | null | null | 1,993 | null | null | mit | null | null | null | null | null | null | null | docs/_extensions/meridianlabs-ai/inspect-docs/post-render.py | null | null | null | null | null | null | Python | 2026-05-04T01:40:31.061862 | """Post-render script for inspect-docs extension.
Generates per-page Markdown (.html.md) files and structured llms.txt output:
1. Converts rendered HTML pages to Markdown via pandoc
2. Generates a structured llms.txt using navigation config and page descriptions
3. Generates llms-full.txt and llms-guide.txt concatenat... |
UKGovernmentBEIS/inspect_ai | https://github.com/UKGovernmentBEIS/inspect_ai | null | null | null | null | 1,993 | null | null | mit | null | null | null | null | null | null | null | docs/evals/sync_all.py | null | null | null | null | null | null | Python | 2026-05-04T01:40:31.085945 | """Merge inspect_evals and inspect_harbor into a single evals.json.
The /docs/evals SPA consumes this file directly.
Usage:
python docs/evals/sync_all.py [--inspect-evals PATH] [--no-fetch]
"""
from __future__ import annotations
import argparse
import json
import sys
from pathlib import Path
import yaml
from ... |
UKGovernmentBEIS/inspect_ai | https://github.com/UKGovernmentBEIS/inspect_ai | null | null | null | null | 1,993 | null | null | mit | null | null | null | null | null | null | null | docs/_extensions/meridianlabs-ai/inspect-docs/filters/reference/render.py | null | null | null | null | null | null | Python | 2026-05-04T01:40:31.086478 | # pyright: basic
from textwrap import dedent
import panflute as pf # type: ignore
from parse import DocAttribute, DocClass, DocFunction, DocObject, DocParameter
# render reference elements
def render_docs(elem: pf.Header, docs: DocObject) -> list[pf.Element]:
# remove 'beta'
title = pf.stringify(elem)
if... |
UKGovernmentBEIS/inspect_ai | https://github.com/UKGovernmentBEIS/inspect_ai | null | null | null | null | 1,993 | null | null | mit | null | null | null | null | null | null | null | docs/evals/sync_harbor.py | null | null | null | null | null | null | Python | 2026-05-04T01:40:31.161911 | """Load inspect_harbor evals into normalized EvalRecord dicts.
Fetches the Harbor dataset registry plus inspect_harbor's generated `_tasks.py`
(for exposed Python function names), joins with inspect_harbor's
`docs/overrides.yml` for fields the registry lacks, and returns records
matching the design schema.
Writes are... |
UKGovernmentBEIS/inspect_ai | https://github.com/UKGovernmentBEIS/inspect_ai | null | null | null | null | 1,993 | null | null | mit | null | null | null | null | null | null | null | docs/extensions/generate.py | null | null | null | null | null | null | Python | 2026-05-04T01:40:31.645620 | import json
import re
from pathlib import Path
import yaml
try:
PATH = Path(__file__).parent
except NameError:
PATH = Path.cwd()
CATEGORY_ORDER = [
"Sandboxes",
"Analysis",
"Frameworks",
"Tooling",
]
with open(PATH / "extensions.yml", "r") as f:
records = yaml.safe_load(f)
# Compute cou... |
UKGovernmentBEIS/inspect_ai | https://github.com/UKGovernmentBEIS/inspect_ai | null | null | null | null | 1,993 | null | null | mit | null | null | null | null | null | null | null | examples/approval/approval.py | null | null | null | null | null | null | Python | 2026-05-04T01:40:31.660702 | import ast
import shlex
from textwrap import dedent
from typing import Set
from inspect_ai import Task, task
from inspect_ai.agent import react
from inspect_ai.approval import Approval, Approver, approver
from inspect_ai.dataset import Sample
from inspect_ai.model import ChatMessage
from inspect_ai.tool import ToolCal... |
UKGovernmentBEIS/inspect_ai | https://github.com/UKGovernmentBEIS/inspect_ai | null | null | null | null | 1,993 | null | null | mit | null | null | null | null | null | null | null | examples/biology_qa.py | null | null | null | null | null | null | Python | 2026-05-04T01:40:31.689461 | from datetime import datetime, timedelta, timezone
from inspect_ai import Task, task
from inspect_ai.dataset import FieldSpec, example_dataset
from inspect_ai.scorer import model_graded_qa
from inspect_ai.solver import generate, use_tools
from inspect_ai.tool import web_search
openai_options = {
"search_context_s... |
UKGovernmentBEIS/inspect_ai | https://github.com/UKGovernmentBEIS/inspect_ai | null | null | null | null | 1,993 | null | null | mit | null | null | null | null | null | null | null | examples/bridge/langchain/agent.py | null | null | null | null | null | null | Python | 2026-05-04T01:40:31.690977 | from uuid import uuid4
from langchain_community.tools.tavily_search import TavilySearchResults
from langchain_core.messages import convert_to_messages
from langchain_openai import ChatOpenAI
from langgraph.checkpoint.memory import MemorySaver
from langgraph.prebuilt import create_react_agent
from inspect_ai.agent imp... |
UKGovernmentBEIS/inspect_ai | https://github.com/UKGovernmentBEIS/inspect_ai | null | null | null | null | 1,993 | null | null | mit | null | null | null | null | null | null | null | examples/bridge/langchain/task.py | null | null | null | null | null | null | Python | 2026-05-04T01:40:31.698395 | from agent import web_research_agent
from inspect_ai import Task, task
from inspect_ai.dataset import json_dataset
from inspect_ai.scorer import model_graded_fact
@task
def research() -> Task:
return Task(
dataset=json_dataset("dataset.json"),
solver=web_research_agent(),
scorer=model_gra... |
UKGovernmentBEIS/inspect_ai | https://github.com/UKGovernmentBEIS/inspect_ai | null | null | null | null | 1,993 | null | null | mit | null | null | null | null | null | null | null | examples/bridge/agentsdk/task.py | null | null | null | null | null | null | Python | 2026-05-04T01:40:31.699318 | from agent import web_research_agent
from inspect_ai import Task, task
from inspect_ai.dataset import json_dataset
from inspect_ai.scorer import model_graded_fact
@task
def research() -> Task:
return Task(
dataset=json_dataset("dataset.json"),
solver=web_research_agent(),
scorer=model_gra... |
UKGovernmentBEIS/inspect_ai | https://github.com/UKGovernmentBEIS/inspect_ai | null | null | null | null | 1,993 | null | null | mit | null | null | null | null | null | null | null | examples/bridge/agentsdk/agent.py | null | null | null | null | null | null | Python | 2026-05-04T01:40:31.741236 | from agents import Agent as OpenAIAgent
from agents import RunConfig, Runner, WebSearchTool
from inspect_ai.agent import Agent, AgentState, agent, agent_bridge
from inspect_ai.model import messages_to_openai_responses
@agent
def web_research_agent() -> Agent:
"""OpenAI Agents SDK search agent."""
async def ... |
UKGovernmentBEIS/inspect_ai | https://github.com/UKGovernmentBEIS/inspect_ai | null | null | null | null | 1,993 | null | null | mit | null | null | null | null | null | null | null | examples/bridge/pydantic-ai/task.py | null | null | null | null | null | null | Python | 2026-05-04T01:40:31.786981 | from agent import web_research_agent
from inspect_ai import Task, task
from inspect_ai.dataset import json_dataset
from inspect_ai.scorer import model_graded_fact
@task
def research() -> Task:
return Task(
dataset=json_dataset("dataset.json"),
solver=web_research_agent(),
scorer=model_gra... |
UKGovernmentBEIS/inspect_ai | https://github.com/UKGovernmentBEIS/inspect_ai | null | null | null | null | 1,993 | null | null | mit | null | null | null | null | null | null | null | examples/bridge/pydantic-ai/agent.py | null | null | null | null | null | null | Python | 2026-05-04T01:40:31.794862 | from pydantic import BaseModel, Field
from pydantic_ai import Agent as PydanticAgent
from pydantic_ai import WebFetchTool, WebSearchTool
from inspect_ai.agent import Agent, AgentState, agent, agent_bridge
from inspect_ai.model import user_prompt
class AnswerToQueryOutput(BaseModel):
answer: str = Field(descripti... |
UKGovernmentBEIS/inspect_ai | https://github.com/UKGovernmentBEIS/inspect_ai | null | null | null | null | 1,993 | null | null | mit | null | null | null | null | null | null | null | examples/browser/browser.py | null | null | null | null | null | null | Python | 2026-05-04T01:40:31.821833 | from inspect_ai import Task, task
from inspect_ai.dataset import Sample
from inspect_ai.scorer import includes
from inspect_ai.solver import generate, use_tools
from inspect_ai.tool import web_browser
@task
def browser():
return Task(
dataset=[
Sample(
input="Use the web browse... |
UKGovernmentBEIS/inspect_ai | https://github.com/UKGovernmentBEIS/inspect_ai | null | null | null | null | 1,993 | null | null | mit | null | null | null | null | null | null | null | examples/cache.py | null | null | null | null | null | null | Python | 2026-05-04T01:40:32.210129 | from inspect_ai import Task, task
from inspect_ai.dataset import Sample
from inspect_ai.model import CachePolicy
from inspect_ai.scorer import match
from inspect_ai.solver import Generate, TaskState, solver
"""
This example demonstrates how to use the cache feature in `inspect_ai` in your custom solvers
"""
def _dat... |
UKGovernmentBEIS/inspect_ai | https://github.com/UKGovernmentBEIS/inspect_ai | null | null | null | null | 1,993 | null | null | mit | null | null | null | null | null | null | null | examples/code_execution.py | null | null | null | null | null | null | Python | 2026-05-04T01:40:32.223372 | from inspect_ai import Task, task
from inspect_ai.dataset import Sample
from inspect_ai.solver import generate, use_tools
from inspect_ai.tool import code_execution
@task
def code_execution_task():
return Task(
dataset=[
Sample(
"Please use your available tools to execute Pytho... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.