Categories
CNNs GANs highly_speculative

DALL-E / 2

and some stable diffusion tests

Categories
highly speculative highly_speculative The Chicken Experience

Consciousness and Potential

A controversial thought… but, when considering the 7 billion male chicks that are destroyed within a day of hatching (per year), what sort of difference exists, between the mind of a baby chick, and a baby human? The conscious experience, (perhaps not yet encumbered by self-modeled reflection, and the psychological maturity of complex thought), still exists in some way. It is like something, to be a living being. Mammals and Birds share a common ancestor, a few hundred million years back, and we both are born, innately knowing, and preferring some things over others.

If there were a debate, with one side seeing infanticide as worse than what we do to chickens, it would probably just come down to ‘the argument from potential’ – and yet… chickens are smarter than human toddlers. I guess that argument needs to change to ‘long term potential’?

Hmm. Interesting thought, anyway.

The topic of how babies and chicks are similar interests others too. (“Born Knowing”, Giorgio Vallortigara)

Categories
AI/ML deep highly_speculative

NLP: Natural Language Processing

NLP. Disambiguation: Not neurolinguistic programming, a discredited therapy, whereby one reprograms themselves, in a sense, to change their ill behaviours.

No, this one is about processing text. Sequence to sequence. Big models. Transformers. Just wondering now, if we need it. I saw an ad of some sort, for ‘Tagalog‘ and thought it was something about the Filipino language, but it was a product for NLP shops, for stuff like OCR, labelling, annotating, stuff. For mining text, basically.

Natural language processing is fascinating stuff, but probably out of the scope of this project. GPT-3 is the big one, and I think Google just released a network an order of magnitude bigger?

Here’s a bit of oddly dystopian exclusivity news, of Microsoft to exclusively license the GPT-3 language model. Amazing.

“Google’s new trillion-parameter AI language model is almost 6 times bigger than GPT-3”, so GPT-3 is old news anyway. I watched some interviews with the AI, and it’s very plucky. I can see why Elon is worried.

I don’t think we’ll need it for chickens.

Categories
doin a heckin inspire highly_speculative meta

Course Design by Prototype Release

I think my CSC 369 class at Cal Poly was a good model, for a type of autonomous course design. There were only 9 students, and there was a presentation of each person’s project, near the end of the course. What made it a bit more interesting, is that the code was shared at the end, and some students incorporated other students’ code into their programs.

There was some remixing. Because we all worked on different things, (I made ‘Gnapster’, a P2P file sharing app with firewall circumvention, while others worked on MD5 encryption, caching and multiple source downloading.)

My thought was that the development of the GGR robots has been towards something simple and accessible, in order to be sure we get *something* working, in time. I have prototypes, and a UI now, and I add features to the robot app, building it up into something workable. Making small improvements.

Despite a couple years now, of playing with AI and ML and CV and robots, etc., I’m still way behind the curve. The project budget is my salary for maybe three months of work in industry (Software engineering). In terms of R&D, we’re way past three months of work. But the scope and pace of the fields, of AI, ML, CV, robotics, are vast, and fast.

In theory, theory and practice are the same. In practice, they are not.” – Albert Einstein

Entire months down a rabbit hole can end with a negative result. Time flies. I felt I needed to start aiming lower, at some point, when the reality hit. Miranda and I are both good at time crunches. So I know we’ll have something presentable, as we get close to the deadline. But there’s only so much one can get done, in a certain amount of time, given the constraints of life. Work, responsibility, friends, family, health., etc.

So my thought was more or less, platforming, open source style, for the sake of remixing. Course design based on remixing the contributions of all the participants, who start with the result of previous iterations.

A major issue with this idea, is version control, because if the remix is done like a software engineering project, merging contributions will bite students. There was always a rush, at some companies I worked at, to get your code in first, to avoid being the one who had to update and merge before committing their code.

There’s ways around this issue though. Mob programming with an expert at the helm is probably the best way to merge code.

So, idea was, like a course or workshop, where people learn to do something – and then they all work on different, individual improvements, on that something, and then the merged improvements become the new prototype, upon which future coursework might be built.

Sometimes, you might just want to scrap the janky mess it’s becoming, and use a different paradigm, entirely. But sometimes you don’t have time for a more elegant paradigm.

Categories
AI/ML Behaviour bio chicken_research control deep dev ears evolution highly_speculative neuro UI

Hierarchical Temporal Memory

Here I’m continuing with the task of unsupervised detection of audio anomalies, hopefully for the purpose of detecting chicken stress vocalisations.

After much fussing around with the old Numenta NuPic codebase, I’m porting the older nupic.audio and nupic.critic code, over to the more recent htm.core.

These are the main parts:

  • Sparse Distributed Representation (SDR)
  • Encoders
  • Spatial Pooler (SP)
  • Temporal Memory (TM)

I’ve come across a very intricate implementation and documentation, about understanding the important parts in the HTM model, way deep, like how did I get here? I will try implement the ‘critic’ code, first. Or rather, I’ll try port it from nupic to htm. After further investigation, there’s a few options, and I’m going to try edit the hotgym example, and try shove wav files frequency band scalars through it instead of power consumption data. I’m simplifying the investigation. But I need to make some progress.

I’m using this docker to get in, mapping my code and wav file folder in:

docker run -d -p 8888:8888 --name jupyter -v /media/chrx/0FEC49A4317DA4DA/sounds/:/home/jovyan/work 3rdman/htm.core-jupyter:latest



So I've got some code working that writes to 'nupic format' (.csv) and code that reads the amplitudes from the csv file, and then runs it through htm.core. 

So it takes a while, and it's just for 1 band (of 10 bands). I see it also uses the first 1/4 of so of the time to know what it's dealing with.  Probably need to run it through twice to get predictive results in the first 1/4. 

Ok no, after a few weeks, I've come back to this point, and realise that the top graph is the important one.  Prediction is what's important.  The bottom graphs are the anomaly scores, used by the prediction.  
Frequency Band 0

The idea in nupic.critic, was to threshold changes in X bands. Let’s see the other graphs…

Frequency band 0: 0-480Hz ?
Frequency band 2: 960-1440Hz ?
Frequency band 3: 1440-1920Hz ?
Frequency band 4: 1920-2400Hz ?
Frequency band 5: 2400-2880Hz ?
Frequency band 6: 2880-3360Hz ?

Ok Frequency bands 7, 8, 9 were all zero amplitude. So that’s the highest the frequencies went. Just gotta check what those frequencies are, again…

Opening 307.wav
Sample width (bytes): 2
Frame rate (sampling frequency): 48000
Number of frames: 20771840
Signal length: 20771840
Seconds: 432
Dimensions of periodogram: 4801 x 2163

Ok with 10 buckets, 4801 would divide into 
Frequency band 0: 0-480Hz
Frequency band 1: 480-960Hz
Frequency band 2: 960-1440Hz
Frequency band 3: 1440-1920Hz
Frequency band 4: 1920-2400Hz
Frequency band 5: 2400-2880Hz
Frequency band 6: 2880-3360Hz

Ok what else. We could try segment the audio by band, so we can narrow in on the relevant frequency range, and then maybe just focus on that smaller range, again, in higher detail.

Learning features with some labeled data, is probably the correct way to do chicken stress vocalisation detections.

Unsupervised anomaly detection might be totally off, in terms of what an anomaly is. It is probably best, to zoom in on the relevant bands and to demonstrate a minimal example of what a stressed chicken sounds like, vs a chilled chicken, and compare the spectrograms to see if there’s a tell-tale visualisable feature.

A score from 1 to 5 for example, is going to be anomalous in arbitrary ways, without labelled data. Maybe the chickens are usually stressed, and the anomalies are when they are unstressed, for example.

A change in timing in music might be defined, in some way. like 4 out of 7 bands exhibiting anomalous amplitudes. But that probably won’t help for this. It’s probably just going to come down to a very narrow band of interest. Possibly pointing it out on a spectrogram that’s zoomed in on the feature, and then feeding the htm with an encoding of that narrow band of relevant data.


I’ll continue here, with some notes on filtering. After much fuss, the sox app (apt-get install sox) does it, sort of. Still working on python version.

                                                                              $ sox 307_0_50.wav filtered_50_0.wav sinc -n 32767 0-480
$ sox 307_0_50.wav filtered_50_1.wav sinc -n 32767 480-960
$ sox 307_0_50.wav filtered_50_2.wav sinc -n 32767 960-1440
$ sox 307_0_50.wav filtered_50_3.wav sinc -n 32767 1440-1920
$ sox 307_0_50.wav filtered_50_4.wav sinc -n 32767 1920-2400
$ sox 307_0_50.wav filtered_50_5.wav sinc -n 32767 2400-2880
$ sox 307_0_50.wav filtered_50_6.wav sinc -n 32767 2880-3360


So, sox does seem to be working.  The mel spectrogram is logarithmic, which is why it looks like this.

Visually, it looks like I'm interested in 2048 to 4096 Hz.  That's where I can see the chirps.

Hmm. So I think the spectrogram is confusing everything.

So where does 4800 come from? 48 kHz. 48,000 Hz (48 kHz) is the sample rate “used for DVDs“.

Ah. Right. The spectrogram values represent buckets of 5 samples each, and the full range is to 24000…?

Sample width (bytes): 2
0.     5.    10.    15.    20.    25.    30.    35.    40.    45.    50.    55.    60.    65.    70.    75.    80.    85.    90.    95.    100.   105.   110.   115.   120.   125.   130.   135.   140.   145.
...
 23950. 23955. 23960. 23965. 23970. 23975. 23980. 23985. 23990. 23995. 24000.]

ok. So 2 x 24000. Maybe 2 channels? Anyway, full range is to 48000Hz. In that case, are the bands actually…

Frequency band 0: 0-4800Hz
Frequency band 1: 4800-9600Hz
Frequency band 2: 9600-14400Hz
Frequency band 3: 14400-19200Hz
Frequency band 4: 19200-24000Hz
Frequency band 5: 24000-28800Hz
Frequency band 6: 28800-33600Hz

Ok so no, it’s half the above because of the sample width of 2.

Frequency band 0: 0-2400Hz
Frequency band 1: 2400-4800Hz
Frequency band 2: 4800-7200Hz
Frequency band 3: 7200-9600Hz
Frequency band 4: 9600-12000Hz
Frequency band 5: 12000-14400Hz
Frequency band 6: 14400-16800Hz

So why is the spectrogram maxing at 8192Hz? Must be spectrogram sampling related.

ol_hann_win
From Berkeley document

So the original signal is 0 to 24000Hz, and the spectrogram must be 8192Hz because… the spectrogram is made some way. I’ll try get back to this when I understand it.

sox 307_0_50.wav filtered_50_0.wav sinc -n 32767 0-2400
sox 307_0_50.wav filtered_50_1.wav sinc -n 32767 2400-4800
sox 307_0_50.wav filtered_50_2.wav sinc -n 32767 4800-7200
sox 307_0_50.wav filtered_50_3.wav sinc -n 32767 7200-9600
sox 307_0_50.wav filtered_50_4.wav sinc -n 32767 9600-12000
sox 307_0_50.wav filtered_50_5.wav sinc -n 32767 12000-14400
sox 307_0_50.wav filtered_50_6.wav sinc -n 32767 14400-16800

Ok I get it now.

Ok i don’t entirely understand the last two. But basically the mel spectrogram is logarithmic, so those high frequencies really don’t get much love on the mel spectrogram graph. Buggy maybe.

But I can estimate now the chirp frequencies…

sox 307_0_50.wav filtered_bird.wav sinc -n 32767 1800-5200

Beautiful. So, now to ‘extract the features’…

So, the nupic.critic code with 1 bucket managed to get something resembling the spectrogram. Ignore the blue.

But it looks like maybe, we can even just threshold and count peaks. That might be it.

sox 307.wav filtered_307.wav sinc -n 32767 1800-5200
sox 3072.wav filtered_3072.wav sinc -n 32767 1800-5200
sox 237.wav filtered_237.wav sinc -n 32767 1800-5200
sox 98.wav filtered_98.wav sinc -n 32767 1800-5200

Let’s do the big files…

Ok looks good enough.

So now I’m plotting the ‘chirp density’ (basically volume).

’98.wav’
‘237.wav’
‘307.wav’
‘3072.wav’

In this scheme, we just proxy chirp volume density as a variable representing stress.  We don’t know if it is a true proxy.
As you can see, some recordings have more variation than others.  

Some heuristic could be decided upon, for rating the stress from 1 to 5.  The heuristic depends on how the program would be used.  For example, if it were streaming audio, for an alert system, it might alert upon some duration of time spent above one standard deviation from the rolling mean. I’m not sure how the program would be used though.

If the goal were to differentiate stressed and not stressed vocalisations, that would require labelled audio data.   

(Also, basically didn’t end up using HTM, lol)

Categories
highly_speculative meta UI

“Mechanical Turk”ing

Audience participation could adds data points and labels, for classification training or similar. But what?

Classification needs a user interface. I saw one here:

Informatics 06 00038 g004 550
Collecting Labels for Rare Anomalies via Direct Human Feedback—An Industrial Application Study

“What type of anomaly is this?”

Informatics 06 00038 g001 550
Reporting an Anomaly

Here is Miranda demonstrating a similar skill

Categories
evolution highly speculative highly_speculative meta The Chicken Experience

Ameglian Major Cow, Chairdogs, etc.

I thought it’s probably worth noting some sci-fi ideas that I remember…

The Ameglian Major Cow (or, Dish of the Day), was the cow in Hitchhiker’s guide book 2, (Restaurant at the end of the Universe), that has been bred to want to be eaten, and when Zaphod Beeblebrox, etc., order steak, the cow goes off to shoot itself, and tells the protagonist, Arthur not to worry: “I’ll be very humane.”

The other thing was chairdogs, that show up in one of the later Dune books. The Tleilaxu are known for taking genetic engineering a bit too far, and one of their exports is a dog that’s been bred until it has become a chair, which massages you. Real ‘creature comforts’. It’s generally used for world building and character development, maybe insinuating that the characters with guilty-pleasure chairdogs, are getting soft.

Interesting, because the artificial selection or genetic engineering leading to these creations is questionable, but the final product is something that inverts or sidesteps morality.

The Ameglian Major Cow is a common thought experiment, as it postulates a question to vegetarians, whether they would eat meat, if it were intelligent, and wanted to be eaten. It’s very hypothetical though.

Chairdogs are closer: if chickens of tomorrow, or other domesticated animals, are ultimately evolved or engineered into simplified protein vats, their ‘souls’ (i.e. CNS) removed, perhaps we’re left with something less problematic, despite the apparent abominating of nature.

Side note: Alex O’Connor, Cosmic Skeptic, has a lot to say, on the philosophy of ethical veganism. Here he answers a question: “Do Animals have a “Right to Life?” – (tl;dw: no. but you should eat less meat)

Categories
highly_speculative

Side Quest
A Speculative Flash Fiction about chicken robots

It was a simple life, being a shredder. Well, not the actual shredder; they have machines to do that now. My profession was to wait for the babies to hatch and throw all the hours-old squealing boys into the gnashing jaws of the shredding device. You see it takes a bit more money to raise a boy, as they don’t suffer from the fat, juicy tenderness and hyper-fertility that only an overload of synthetic bio-chemicals can provoke in the girls. Not much more money, but these little squealing fluffy yellow ping pong balls with vestigial wings are what the Capatriarchal bosses called “economically unviable entities”. I can relate, in a way. I used to work on an Outside Farm, where I would tend to orchards of cloned oranges, decipher the needs of transgenic maize and pollinate almond trees. But, they have machines to do that now.

As clever and strong as they are, it’s hard for the average industrial machine to tell the difference between boy and girl chicks, so I’d use my multi million-year evolved vision and the advanced tactile response mechanisms of my nimble fingers to differentiate and toss them as fast as I could, for fear of becoming economically univiable, into the machine, and at the end of the month I could pay my Shelter Fee to the Capatriarchalists, and every night I’d have food on my table. Usually rice, and some vegetables, and beans for protein, because meat was too expensive. And I couldn’t stand the smell of chicken after spending all that time handling the tepid strawberry milkshake-like puree of chicks, plucking out clumped meshes of minikin feathers so we could sell it in vats to the pig factory at the best price per litre.

These comforts became threatened when the robots were released. It started a few batteries away. My friends told me that Rainbow Chickens & co. got shut down, because some robot appeared one day and set all the chickens free. I laughed. But the muscles in my friends’ faces had flatlined. The robot seemed hard-wired to protect the chickens at whatever cost, and the workers, the gun-laden security guards and all the cages and fences proved no match for the aggressively dexterous and intelligent machine.

The Rainbow Chickens and their robot roamed around the outskirts of the city. Watching the vernacular video of the odd codependency, which got a couple thousand virtual hearts on The Citizen’s Channel, we could never have imagined our routine and whole way of life could be disrupted by this artificial symbiosis. But it was when the next generation hatched that things became inescapably peculiar; the first being the chicks saw when cracking through their chalky shells was an aluminium arm, riddled with bolts glinting in the sunlight, with the warm hum of servo motors mumbling in unison with the delicate tending to of the egg. In an act of evolutionary misguidance, the chicks presumed this being was their mother and imprinted on the machine. Some kind of feedback loop was created between the ever-evolving artificial intelligence and the fast-adapting chicks, and their resulting behaviours were unintelligible to the human mind. For one, the machine took over the task of incubating the eggs which opened up a lot of time for hens to pursue other endeavours, which we could only comprehend to be cultural activities.

As the flock grew, so did hierarchical tensions, leading to social unrest and violence within the group. It became apparent that a split was necessary, yet the newly afforded freedoms that came with the robot complexified this natural process. The AI quantified that the only way to solve this was to mechanically clone itself. Stored somewhere on its SD card was the memory of other robots used to handle chickens, although techno-evolutionarily misguided ones. Components from automated feeders, roaming faeces vacuums, incubators, mechanical deboners, boy chick shredders, and factory climate control units were gently dismantled and reassembled into as-similar-as-possible robots. The need for more parts meant going to more battery farms, which in turn also meant more chickens being released. The rate of liberation was exponential, and before we had even taken the peculiar situation seriously, the system keeping our daily lives in check had begun to unravel.

With their nutritionally diverse menus of scraps and incandescent warmth, many flocks migrated to urban spaces, causing a surprising amount of inconvenience for the normative city functionings. For one, they seemed very drawn to the tar roads, as the asphalt soaked up the sun’s heat and the gravel debris was a popular digestive aid to be pecked at. Attempts to drive through the encampments were futile; between a mass of angry talons and an advanced AI that could hack any device within eighty metres, cars and trucks were abandoned and only small, non-motorised transportation was possible when navigating the city. People who worked far from home lost their jobs. Inter-city trade fell apart. Store shelves became barren. The smog cleared, and the sky was blue and brilliant for the first time in two hundred and fifty years.

***

For bakeries to survive, parking lots were transformed into emergency flax farms. Cosmetic and biotechnology companies had to produce expensive lab-grown albumen for their products. Wine became murkier. Cinema houses became overrun by broods of plumage and pistons, due to their pre-existing bulk maize-cooking technology. The inconvenience and discomfort experienced by movie-goers led to a gradual deterioration of interest in the stereotype-perpetuating Capatriarchal-issued movies, while citizens sought consolatory media which more sensitively reflected the changes they were experiencing in their daily lives.

As a result of the chickens’ extensive urban roaming, seeds in neat packages of faecal fertiliser were distributed in ruderal landscapes across cities. Tomatoes, berries, corn, lemons – whatever genetically unmodified fresh produce still had viable seeds inside – began sprouting in traffic islands, in dog-walking parks, between cracks in cement pavements. Municipalities’ urban cleaning departments were ordered to remove these “weeds”, these unexpected, uncurated nourishing invasives, but the human residents began to protest. Never before had they had access to such fresh, organically-grown produce, which was of course also free, and easily harvestable on their commute home. Those who had lost their jobs in the rippling chaos, like myself, had grown dependent on these impromptu, decentralised farms. Along with the fresh, unfertilised eggs which the robots would cautiously leave on the edges of pathways, the nutritional requirements of many urban human residents were being met free of charge.

The financial devastation to many multi-million Zoplar industries was of course met with bureaucratic rage within the Capatriarchalist structure, and a rogue hacktivist group called the Technowitches were tracked down as being responsible. They had caught them via their digital footprint, with the picture created by their Virtual Value transactions, search terms used when accessing Digital Information Archives, keywords in personal messaging communications, and blatant disrespect for the Capatriarchalist system evident in all of their Community Media posts over the last decade. They had triangulated on these clues, which led them directly to the Shelter Fee collector the hacktivists were registered with.

The Technowitches were indefinitely detained on the grounds of treason and disrupting public order, until they could terminate the anarchic devices. Even in duressed collaboration with the authorities’ top digital scientists, this proved seemingly impossible; the artificial intelligence had evolved autonomously and the Capatriarchalist’s weaponised technology was rendered useless against the metallic creatures.

At some point the Capatriarchalist / Technowitch saga faded from the digital newspapers, as we tried to adapt and get on with our lives. Now I spend my days making sure the farms in my neighbourhood are all running smoothly, teaching my neighbours about the patience you need when working with living organisms as most of them only know how to interact with pixels and trackpads, which don’t talk back. I like to flex my nimble fingers separating grains from chaff, at whatever speed relates to how much bread I’d like from the bakery before they close for the night, and it is a simple life.

In the uncertain times, in the thick of the system’s crisis, it was less simple; we were working night and day to keep the water supplies consistent after they cut off the pipes to our neighbourhood. We would have to manually collect, filter, distill and treat the water, keeping it in a closed cycle to waste as little as possible. It was a stressful and exhausting time. But, we have machines to do that now.

Categories
highly_speculative

flash notes on text

aka some thoughts on a speculative fiction about chicken-protecting robots
Categories
highly_speculative

Chickenefied EU Civil Laws on Robotics
find and replace game

non-anthropocentric robotic laws | Digital Colonialism

find-and-replace-game-civil-laws-robotics-eu-chickened.pdf

Can also be listened to hear ( well like 3/4 of it)