← 返回 Skills 市场
ivangdavila

Keras

作者 Iván · GitHub ↗ · v1.0.0
linuxdarwinwin32 ✓ 安全检测通过
490
总下载
2
收藏
7
当前安装
1
版本数
在 OpenClaw 中安装
/install keras
功能描述
Build, train, and debug deep learning models with Keras patterns, layer recipes, and training diagnostics.
使用说明 (SKILL.md)

Setup

On first use, check setup.md for integration guidelines. The skill stores preferences in ~/keras/ when the user confirms.

When to Use

User builds neural networks with Keras or TensorFlow. Agent handles model architecture, layer configuration, training loops, callbacks, debugging loss issues, and deployment preparation.

Architecture

Memory lives in ~/keras/. See memory-template.md for setup.

~/keras/
├── memory.md          # Preferred architectures, hyperparams
└── models/            # Saved model configs (optional)

Quick Reference

Topic File
Setup process setup.md
Memory template memory-template.md
Layer patterns layers.md
Training diagnostics training.md
Common architectures architectures.md

Core Rules

1. Sequential vs Functional API

  • Sequential: simple stacks, no branching
  • Functional: multi-input/output, skip connections, shared layers
  • Subclassing: custom forward pass, dynamic architectures
# Sequential - simple stack
model = keras.Sequential([
    layers.Dense(64, activation='relu'),
    layers.Dense(10, activation='softmax')
])

# Functional - flexible graphs
inputs = keras.Input(shape=(784,))
x = layers.Dense(64, activation='relu')(inputs)
outputs = layers.Dense(10, activation='softmax')(x)
model = keras.Model(inputs, outputs)

2. Input Shape Patterns

  • First layer needs input_shape (exclude batch)
  • Images: (height, width, channels) for channels_last
  • Sequences: (timesteps, features)
  • Tabular: (features,)
# Image input
layers.Conv2D(32, 3, input_shape=(224, 224, 3))

# Sequence input
layers.LSTM(64, input_shape=(100, 50))  # 100 timesteps, 50 features

# Tabular input
layers.Dense(64, input_shape=(20,))  # 20 features

3. Activation Functions

Task Output Activation Loss
Binary classification sigmoid binary_crossentropy
Multi-class softmax categorical_crossentropy
Multi-label sigmoid binary_crossentropy
Regression linear (none) mse or mae

4. Regularization Stack

Apply in this order for overfitting:

  1. Dropout - after dense/conv layers (0.2-0.5)
  2. BatchNorm - before or after activation
  3. L2 regularization - in layer (0.01-0.001)
  4. Early stopping - callback with patience
layers.Dense(64, activation='relu', kernel_regularizer=keras.regularizers.l2(0.01))
layers.Dropout(0.3)
layers.BatchNormalization()

5. Callbacks Essentials

callbacks = [
    keras.callbacks.EarlyStopping(
        monitor='val_loss', patience=5, restore_best_weights=True
    ),
    keras.callbacks.ModelCheckpoint(
        'best_model.keras', save_best_only=True
    ),
    keras.callbacks.ReduceLROnPlateau(
        monitor='val_loss', factor=0.5, patience=3
    ),
    keras.callbacks.TensorBoard(log_dir='./logs')
]

6. Data Pipeline

# tf.data for performance
dataset = tf.data.Dataset.from_tensor_slices((x, y))
dataset = dataset.shuffle(10000).batch(32).prefetch(tf.data.AUTOTUNE)

# ImageDataGenerator for augmentation
datagen = keras.preprocessing.image.ImageDataGenerator(
    rotation_range=20,
    horizontal_flip=True,
    validation_split=0.2
)

7. Compile Checklist

model.compile(
    optimizer=keras.optimizers.Adam(learning_rate=0.001),
    loss='categorical_crossentropy',
    metrics=['accuracy']
)
  • Learning rate: start 0.001, reduce on plateau
  • Batch size: 32-128 typical, larger = smoother gradients

Common Traps

  • Input shape mismatch → check data shape vs model input_shape, exclude batch dim
  • Loss is NaN → reduce learning rate, check for inf/nan in data, add gradient clipping
  • Validation loss diverges → add regularization, reduce model capacity, more data
  • Model not learning → check labels are correct, verify loss function matches task
  • GPU OOM → reduce batch size, use mixed precision, gradient checkpointing
  • Slow training → use tf.data pipeline with prefetch, enable XLA compilation

External Endpoints

Endpoint Data Sent Purpose
TensorFlow model hub None (download only) Pretrained weights when using weights='imagenet'

Note: Transfer learning examples download pretrained weights on first use. Use weights=None for fully offline operation.

Security & Privacy

Data that stays local:

  • Model architectures and configs in ~/keras/
  • Training preferences and hyperparameters

This skill does NOT:

  • Upload models or data anywhere
  • Access files outside ~/keras/ and working directory
  • Store training data

Related Skills

Install with clawhub install \x3Cslug> if user confirms:

  • tensorflow — TensorFlow operations and deployment
  • pytorch — Alternative deep learning framework
  • ai — General AI and ML patterns
  • models — Model architecture design

Feedback

  • If useful: clawhub star keras
  • Stay updated: clawhub sync
安全使用建议
This skill appears internally consistent and focused on Keras workflows. Before installing, note: (1) it will ask before creating ~/keras/ and storing preferences there — confirm if you want that; (2) transfer-learning examples may download pretrained weights from TensorFlow model hubs (network activity) — set weights=None for full offline use; (3) it needs python3 available on PATH; and (4) it does not request any tokens/credentials or instruct data uploads. If you want extra caution, review and approve any file writes the first time it runs.
功能分析
Type: OpenClaw Skill Name: keras Version: 1.0.0 The OpenClaw Keras skill is benign. It provides instructions and code examples for building and training deep learning models. The skill explicitly states its intent to store user preferences and model configurations locally in `~/keras/` and to download pretrained weights from the TensorFlow model hub, both of which are legitimate and declared behaviors for a deep learning skill. The agent instructions in `SKILL.md`, `setup.md`, and `memory-template.md` emphasize transparency, user consent for file operations, and explicitly state that the skill does not upload data or access files outside its designated directory. There is no evidence of malicious intent, data exfiltration, or unauthorized actions.
能力评估
Purpose & Capability
Name/description (Keras modeling, training, debugging) align with the files and instructions: architecture recipes, layer patterns, training diagnostics. Required binary is only python3 and there are no unrelated environment variables or config paths.
Instruction Scope
SKILL.md and supporting docs limit actions to advising, creating a small ~/keras/ memory directory (only with user consent), producing code examples, and optionally downloading pretrained weights (noted explicitly). There are no instructions to read unrelated system files, access credentials, or send data to unknown endpoints.
Install Mechanism
This is an instruction-only skill with no install spec and no code to write to disk beyond optionally creating ~/keras/ (after asking the user). That is the lowest install risk.
Credentials
The skill declares no required environment variables or credentials. All suggested operations (training code, saving models, TensorFlow weight downloads) are proportional to a Keras helper; nothing asks for unrelated secrets or cloud credentials.
Persistence & Privilege
always is false and the skill only stores preferences in ~/keras when the user explicitly confirms. It does not request permanent system-wide privileges or modify other skills' configs.
如何使用
  1. 确保已安装 OpenClaw(本地或 Docker 部署)
  2. 在对话框中输入安装命令:/install keras
  3. 安装完成后,直接呼叫该 Skill 的名称或使用 /keras 触发
  4. 根据 Skill 的参数说明提供必要输入,即可获得结构化输出
版本历史
v1.0.0
Initial release
元数据
Slug keras
版本 1.0.0
许可证
累计安装 7
当前安装数 7
历史版本数 1
常见问题

Keras 是什么?

Build, train, and debug deep learning models with Keras patterns, layer recipes, and training diagnostics. 它是一个面向 Claude Code / OpenClaw 的 AI Agent Skill 插件,目前累计下载 490 次。

如何安装 Keras?

在 OpenClaw 或 Claude Code 对话框中运行命令「/install keras」即可一键安装,无需额外配置。

Keras 是免费的吗?

是的,Keras 完全免费(开源免费),可自由下载、安装和使用。

Keras 支持哪些平台?

Keras 跨平台运行,可在任意部署了 OpenClaw / Claude Code 的环境中使用(linux, darwin, win32)。

谁开发了 Keras?

由 Iván(@ivangdavila)开发并维护,当前版本 v1.0.0。

💬 留言讨论