Category Archives: Software

Responsibility for algorithms

Excellent paper at towardsdatascience.com about the responsibility for algorithms including a

broad framework for involving citizens to enable the responsible design, development, and deployment of algorithmic decision-making systems. This framework aims to challenge the current status quo where civil society is in the dark about risky ADS.

I think that the responsiblity is not primarily with the developer but with the user and the social and political framework ( SPON has a warning about the numerous crazy errors when letting AI decide about human behaviour while I can also recommend here the “Weapons of Math Destruction” ).

Being now in the 3rd wave of machine learning, the question is now already discussed (Economist & Washington Post) if AI has an own personality.

 

 

The dialogue sounds slightly better than ELIZA but again way off.

We clearly need to regulate that gold rush to avoid further car crashes like this one in China and this one in France.

 

CC-BY-NC Science Surf , accessed 24.08.2026

Ein Fahrrad Abstandswarner

Nach Stromzähler und Gasuhr kommt hier nun mein drittes Raspberry Pi Zero Projekt: ein Abstandswarner für vorbeifahrende Fahrzeuge. Das erste Mal habe ich davon in einem wissenschaftlichen Artikel gelesen, dann gab es den Radmesser in Berlin (das Projekt war toll aber die Kiste dann doch etwas sperrig).

Auch auf Kickstarter stand mal was und dann gibt es auch noch den 200€ Varia Radar von Garmin – allerdings hatte keines der bisherigen Projekte eine Kamera eingebaut.

Laser und ToF hatte es mir immer schon angetan, dann probieren wir das auch mal hier.

Continue reading Ein Fahrrad Abstandswarner

 

CC-BY-NC Science Surf , accessed 24.08.2026

Apropos Gasboykott – wie hoch ist eigentlich mein Gasverbrauch?

Den Gasverbrauch zu reduzieren wäre nun auch aus aktuellen politischen GrĂĽnden sinnvoll. Allerdings mĂĽsste man dafĂĽr den Verbrauch verstehen und nicht nur einmal im Jahr ablesen…

Katapult auf Twitter https://twitter.com/Katapultmagazin/status/1502327030150533125

Nachdem es mit etwas Computerkenntnissen möglich ist, einen Stromzähler mit einem Raspberry PI auszulesen, mĂĽsste die Methode auch beim Gaszähler funktionieren. Die “Gasuhr” funktioniert dabei so, dass zwei Balgen wechselseitig gefĂĽllt werden und die FĂĽllung einer Kammer ĂĽber eine Kurbelmechanik ein Zählrad antreibt. Continue reading Apropos Gasboykott – wie hoch ist eigentlich mein Gasverbrauch?

 

CC-BY-NC Science Surf , accessed 24.08.2026

Another problem in AI: Out-of-distribution generalization

Not sure if it is really the biggest but certainly one of the most pressing problems: Out-of-distribution generalization. It is explained as

Imagine, for example, an AI that's trained to identify cows in images. Ideally, we'd want it to learn to detect cows based on their shape and colour. But what if the cow pictures we put in the training dataset always show cows standing on grass? In that case, we have a spurious correlation between grass and cows, and if we're not careful, our AI might learn to become a grass detector rather than a cow detector.

As an epidemiologist I would have simply said, it is colliding or confounding, so every new field is rediscovering the same problems over and over again.

 

 

Not unexpected AI just running randomly over pixels is leading to spurious association. Once shape and colour of cows has been detected, surrounding environment, like grass or stable is irrelevant. That means that after getting initial results we have to step back, simulate different lighting conditions from sunlight to lightbulb and environmental conditions from grass to slatted floor (invariance principle). Also shape and size matters – cow spots will keep to some extent size and form irrespective if it is a real animal or children toy (scaling principle). I am a bit more sceptical about including also multimodal data (eg smacking sound) as the absence of these features is no proof of non-existence while this sound can also be imitated by other animals.

And yes, less is more.

 

CC-BY-NC Science Surf , accessed 24.08.2026

Personalized PDFs

Scientific publishers are creating now more and more dynamic PDFs. Why do we know? There is an unexpected loading delay of a PDF from Routledge / Taylor & Francis group that I observed recently. First I thought about some DDos protection, but is indeed a personalized document.

These websites are all being contacted while creating this PDF:

Scitrus.com seems to be part of a larger reference organizer network and links to scienceconnect.io. Alexametric.com is the soon to be retired Alexa internet / Amazon service. Snap.lidcdn.com forwards to px.ads.linkedin.com, the business social network. Then we have Twitter ads, Cloudflare security and Google Analytics. All major players now know that my IP is interested in COVID-19 research. Did I ever agree to submit my IP and time stamp when looking up a rather crude scientific paper?

This is exactly what the German DFG already warned us about last October

For some time now, the major academic publishers have been fundamentally changing their business model with significant implications for research: aggregation and the reuse or resale of user traces have become relevant aspects of their business. Some publishers now explicitly regard themselves as information analysis specialists. Their business model is shifting from content provision to data analytics.

Another paper describes the situation as “Forced marriages and bastards”…

My question is : Will Francis & Taylor even do more? The structure of PDFs allows including objects including Javascript. When examining “document.pdf” using pdf-parser I could not find any javascript or my current IP in clear text. I cannot exclude however that the chopped up IP is stamped somewhere in the document. So I will have try again at a later time point and redo a bitwise analysis. of the same PDF delivered on another day.

At least the DFG document says that organisations might argue that such software allows for the prosecution of users of shadow libraries. While I have doubts that this is legal, we already see targeted advertisement as I received this PDF from Wiley that included an Eppendorf ad.

Screenshot 20.1.2022

When I downloaded this document a second time using a different IP it was however identical. Blood/Elsevier only let’s you even download only after watching a small slideshow…

Screenshot 20.1.2022

 

CC-BY-NC Science Surf , accessed 24.08.2026

Die Anfänge

Mein erster Computer war ein Sharp PC 1211 als Dauerleihgabe von einem Freund um damit T-test und Wilcoxon Test ab 1983 zu rechnen. Konnte immerhin 1424 Zeilen BASIC Code verstehen und sogar ausdrucken.

Getippt hat mir die handgeschriebene Promotionsarbeit eine Freundin auf einer Olivetti Schreibmaschine mit Zeilenspeicher, die Grafiken entstanden auf einem CAD Plotter! bei dedata. Es folgten dann ein IBM XT im Labor und ein ausgeliehener Schneider PC zu Hause …

 

CC-BY-NC Science Surf , accessed 24.08.2026

Wechselrichter und Stromzähler mit FRITZ!Box verbinden

Es wäre interessant, die Daten der Photovoltaik zur Steuerung von Steckdosen zu nehmen, um Geräte nur bei Ăśberschuss anzuschalten. Und zwar ohne teure extra Hardware oder einen Smartmeter, der auch noch alle Haushaltsdaten nach aussen funkt quasi als Einladung an potentielle Einbrecher …

Die Kopplung geht einfacher als gedacht. Mein Fronius Wechselrichter ist im Heimnetz unter http://192.168.187.1/solar_api/v1/GetPowerFlowRealtimeData.fcgi zu erreichen. Die aktuelle Wattzahl kommt im json Format.

Die FRITZ!Box kann die Daten zwar im Augenblick nicht verarbeiten (AVM hat dies aber als Produktvorschlag akzeptiert), dafür kann die FRITZ!Box eine Steckdose schalten. Also brauchen wir doch einen zweiten Rechner zur Überbrückung. Ich nehme dafür einen Raspberry Pi Zero (der Pi Zero 2 ist vergriffen, aber auch nicht notwendig) am besten in der Ausführung WH mit Pinleiste. Stromversorgung kommt von einem Netzteil in Nähe des Sicherungskasten/Stromzählers, zum Test über 3 Tage reicht aber auch eine übliche Powerbank.

Zunächst wird das Pi OS auf eine alte micro SD Karte installiert und die Karte in den Zero gesteckt. Sobald der Zero dann im WLAN erscheint, kann man ihn headless d.h, ohne Peripheriegeräte via SSH weiter konfigurieren. Als Messeinheit brauchen wir noch einen USB IR Lesekopf, der am Stromzähler das Blinken der Diode ausliest.

Mit einem cronjob werden im Minutenabstand die Daten abgeholt. Die Abfrage des Logarex Wechselstromzählers funktioniert dabei mit

stty -F /dev/ttyUSB0 300 -parodd cs7 -cstopb parenb -ixoff -crtscts -hupcl -ixon -opost -onlcr -isig -icanon -iexten -echo -echoe -echoctl -echok
echo -n -e '\x2F\x3F\x21\x0D\x0A' >> /dev/ttyUSB0
timeout 10s cat /dev/ttyUSB0

Ab einer bestimmten Leistung der PV kann dann die Steckdose eingeschaltet werden, im Prinzip mit

watt=$(curl http://192.168.187.1/solar_api/v1/GetPowerFlowRealtimeData.fcgi | jq '.Body.Data.Inverters[1].P')
if [[ $watt -gt 200 ]]
then
http://fritz.box/webservices/homeautoswitch.lua?switchcmd=setsimpleonoff&ain=13077%200012360-1&onoff=1

Die Hardware passt in ein kleines Gehäuse, die Kosten liegen unter 50€, dazu kommt noch die schaltbare Steckdose.

 

Update 26.1.22

Der Abfragecode ist nun in ein PHP Skript verpackt und gibt die Daten in einer hĂĽbschen d3.js Grafik aus.

Im Augenblick läuft die Datensammlung inklusive regelmässiger openweathermap Abfrage um später ein R-CNN zur Vorhersage zu programmieren.

 

Update 23.2.22

Der Lesekopf funktionierte einwandfrei mit dem Drehstromzähler Logarex LK13BDxxxx obwohl die Shell Kommandos nur sehr primitiv in ein PHP Skript eingebaut waren.

Mit dem Einbau eines neuen bidirektionalen Smartmeters SGM-C4-xxxxxx durch unseren Stromversorger funktioniert das leider nicht mehr. Problem ist nicht etwa, daß die Kommunikation nun mit 9600/8/N/1 läuft, das Problem ist daß die binäre SML Zeichen, die nun jede Sekunde kommen, nicht richtig interpretiert werden.

stty -F /dev/ttyUSB0 9600 cs8 -cstopb -parenb
timeout 2s cat /dev/ttyUSB0 | od -tx1

Python downgrade fĂĽr den php_loader machte wenig Sinn, node liess sich auch nicht auf dem Zero installieren und smeterd brach leider mit einer Fehlermeldung ab. Einzig mit libsml hatte ich aber Erfolg

apt-get install uuid-dev uuid-runtime
git clone https://github.com/volkszaehler/libsml
cd libsml
make
examples/sml_server -s /dev/ttyUSB0

Die -s Option ist dabei undokumentiert, aber wichtig denn nur sie findet genau einen Datensatz. Aus Zeilen 1.8.0 und 2.8.0 lässt sich über einen regex Ausdruck der Zählerstand auslesen.

 

Update 2.3.22

Auf Anfrage kann ich auch das komplette Messgerät verleihen, falls jemand denselben Zähler testweise auslesen oder die SD Karte klonen möchte. Wenn sich der Zero nicht das eigenes WLAN findet, startet er einen eigenen Hotspot, ist damit also autonom überall verwendbar.

Update 6.9.22

Läuft und läuft … Allerdings boote ich nun einmal in 24 Stunden per crontab , da sich manchmal nach 10 Tagen der Zero aufhängt.

0 1 * * * shutdown -r now

Update 8.11.22

Läuft nun seit 10 Monaten ohne einen Ausfall, genauso wie der Gaszähler.

 

CC-BY-NC Science Surf , accessed 24.08.2026

From Markdown to Bookend and back

When writing text in Typora, I need Bookends to insert references.

Export to RTF format for creating the bibliography isn’t a big deal but using the new RTF in Typora needs Pandoc on the command line as Typora’s import function is broken.

brew install pandoc
pandoc --wrap=none --extract-media=images -f rtf -t markdown myfile.rtf -o myfile.md

Seems that pandoc destroys footnotes and inline images making this combination not a first choice for larger documents.

 

CC-BY-NC Science Surf , accessed 24.08.2026

Good scientific graphics

I have lectured about good graphics more than a decade ago – basically introducing Edward Tufte as the “Leonardo da Vinci” of data. With the beginning of 2022 I am now absolutely overwhelmed by the number of excellent tutorials out there. Here is my recommended list

 

CC-BY-NC Science Surf , accessed 24.08.2026

The Python nightmare: How to install mask_rcnn and detectron2

Coming from R the most exciting thing with Python is the incompatibility of the different modules…

While I can recommend the Anaconda Navigator, the following commands work only in the terminal.

Thanks to Nouman945 for help with the original mask_rcnn instructions.

conda create --name matterport python=3.6.13 tensorflow==1.15.0 Keras==2.2.4 h5py==2.8.0 pip
conda activate matterport
git clone https://github.com/matterport/Mask_RCNN.git
cd ./Mask_RCNN-master
python -m pip install -r requirements.txt
git clone https://github.com/philferriere/cocoapi.git
python -m pip install pycocotools
python -m pip install git+https://github.com/philferriere/cocoapi.git#subdirectory=PythonAPI
wget https://github.com/matterport/Mask_RCNN/releases/download/v2.1/mask_rcnn_balloon.h5 > Mask_RCNN/mask_rcnn_coco.h5
conda deactivate

For detectron I follow basically detectron2.readthedocs.io

conda create --name detectron2 python=3.6.13 tensorflow==1.15.0 Keras==2.2.4 h5py==2.8.0 pip
conda activate detectron2
conda install pytorch==1.8.0 torchvision==0.9.0 torchaudio==0.8.0 -c pytorch
git clone https://github.com/facebookresearch/detectron2.git
CC=clang CXX=clang++ ARCHFLAGS="-arch x86_64" python -m pip install -e detectron2
conda deactivate

Last but not least the installed apps:

 

CC-BY-NC Science Surf , accessed 24.08.2026